天天看點

flutterapp部分手機無法打開_Flutter應用程式在最新更新後無法運作

flutterapp部分手機無法打開_Flutter應用程式在最新更新後無法運作

Environment Details

Windows + VS Code

Flutter 1.17.5 • channel stable • https://github.com/flutter/flutter.git

Framework • revision 8af6b2f038 (3 days ago) • 2020-06-30 12:53:55 -0700

Engine • revision ee76268252

Tools • Dart 2.8.4

Error From Debug Console

E:\apps\flutterCode\android\app\src\main\java\com\example\testApp\MainActivity.java:3: error: package android.support.annotation does not exist

import android.support.annotation.NonNull;

^

E:\apps\flutterCode\android\app\src\main\java\com\example\TestApp\MainActivity.java:10: error: cannot find symbol

public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {

^

symbol: class NonNull

location: class MainActivity

2 errors

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':app:compileDebugJavaWithJavac'.

> Compilation failed; see the compiler error output for details.

* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 10s

Exception: Gradle task assembleDebug failed with exit code 1

解決方案

try changing the minimum SDK version in the Android/build.gradle from 16 to 21.

if it is still not working try to change the build type function as below.

buildTypes {

release {

minifyEnabled true

// TODO: Add your own signing config for the release build.

// Signing with the debug keys for now, so `flutter run --release` works.

signingConfig signingConfigs.debug

}

}