Recently I updated the flutter version on 2020/06/10. It should be 1.17.3. Now I am using the stable version locally, but the official stable version is recommended.
The problem now is that the android package reports an error.
Talk about the problem and take a look.
Running Gradle task 'assembleRelease'...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
> Could not resolve io.flutter:flutter_embedding_debug:1.0.0-ee76268252c22f5c11e82a7b87423ca3982e51a7.
Required by:
project :app
project :app > project :fluttertoast
project :app > project :package_info
project :app > project :flutter_plugin_android_lifecycle
project :app > project :url_launcher
project :app > project :webview_flutter
project :app > project :flutter_blue
project :app > project :path_provider
project :app > project :shared_preferences
project :app > project :image_picker
project :app > project :url_launcher_web
project :app > project :barcode_scan
> Skipped due to earlier error
> Skipped due to earlier error
> Skipped due to earlier error
> Could not resolve io.flutter:armeabi_v7a_debug:1.0.0-ee76268252c22f5c11e82a7b87423ca3982e51a7.
Required by:
project :app
> Skipped due to earlier error
> Skipped due to earlier error
> Skipped due to earlier error
> Could not resolve io.flutter:arm64_v8a_debug:1.0.0-ee76268252c22f5c11e82a7b87423ca3982e51a7.
Required by:
project :app
> Skipped due to earlier error
> Skipped due to earlier error
> Skipped due to earlier error
> Could not resolve io.flutter:x86_64_debug:1.0.0-ee76268252c22f5c11e82a7b87423ca3982e51a7.
Required by:
project :app
> Skipped due to earlier error
> Skipped due to earlier error
> Skipped due to earlier error
> Could not resolve io.flutter:x86_debug:1.0.0-ee76268252c22f5c11e82a7b87423ca3982e51a7.
Required by:
project :app
> Skipped due to earlier error
> Skipped due to earlier error
> Skipped due to earlier error
* 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 5m 26s
I checked the problem online and saw that a ladder could be solved, and then I thought of it. . .
What's the problem? I can’t resolve dependencies literally. Think about it when configuring xcode at that time, various packages could not be downloaded, and dependencies could not be resolved, and then the Tsinghua mirror image used, it is estimated that this problem is possible, so I went to find gradle script.
Solve the problem:
1. Find the /flutter/packages/flutter_tools/gradle/flutter.gradle package file
Modify maven repro
46 class FlutterPlugin implements Plugin<Project> {
47 //update 20200610
48 //private static final String MAVEN_REPO = "https://storage.googleapis.com/download.flutter.io";
49 private static final String MAVEN_REPO = "https://storage.flutter-io.cn/download.flutter.io";
50 // The platforms that can be passed to the `--Ptarget-platform` flag.
51 private static final String PLATFORM_ARM32 = "android-arm";
52 private static final String PLATFORM_ARM64 = "android-arm64";
53 private static final String PLATFORM_X86 = "android-x86";
54 private static final String PLATFORM_X86_64 = "android-x64";
Modify the first paragraph
24 buildscript {
25 repositories {
26 // 去掉这两个 20200610
27 // google()
28 // jcenter()
29 maven { url'https://maven.aliyun.com/repository/google'}
30 maven { url'https://maven.aliyun.com/repository/jcenter'}
31 maven { url'http://maven.aliyun.com/nexus/content/groups/public'}
32 }
33 dependencies {
34 classpath 'com.android.tools.build:gradle:3.5.0'
35 }
36 }
Modify the second paragraph:
204 void addFlutterDependencies(buildType) {
205 String flutterBuildMode = buildModeFor(buildType)
206 if (!supportsBuildMode(flutterBuildMode)) {
207 return
208 }
209 String repository = useLocalEngine()
210 ? project.property('local-engine-repo')
211 : MAVEN_REPO
212
213 project.rootProject.allprojects {
214 repositories {
215 maven {
216 url repository
217 }
218 //增加这段代码update by lwd
219 maven { url'https://maven.aliyun.com/repository/google'}
220 maven { url'https://maven.aliyun.com/repository/jcenter'}
221 maven { url'http://maven.aliyun.com/nexus/content/groups/public'}
222 }
223 }
2. Modify the build.gradle under android of the project
buildscript {
repositories {
//google()
//jcenter()
maven { url'https://maven.aliyun.com/repository/google'}
maven { url'https://maven.aliyun.com/repository/jcenter'}
maven { url'http://maven.aliyun.com/nexus/content/groups/public'}
}
Compile after solving
weidong:xy-domes-app weidong$ flutter build apk --release
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'... 注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
注: /Users/weidong/install/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_blue-0.7.2/android/src/main/java/com/pauldemarco/flutter_blue/FlutterBluePlugin.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: /Users/weidong/install/workspace/xy-domes-app/build/flutter_blue/generated/source/proto/release/javalite/com/pauldemarco/flutter_blue/Protos.java使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: /Users/weidong/install/flutter/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.22+1/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebView.java使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
注: /Users/weidong/install/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.4.10/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: /Users/weidong/install/workspace/xy-domes-app/android/app/src/main/java/com/xy/domes/app/BleOpenOperation.java使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
Calling mockable JAR artifact transform to create file: /Users/weidong/.gradle/caches/transforms-2/files-2.1/1fae5d14af02af09d1d0dab18bf190e5/android.jar with input /Users/weidong/Library/Android/sdk/platforms/android-28/android.jar
Calling mockable JAR artifact transform to create file: /Users/weidong/.gradle/caches/transforms-2/files-2.1/9f586020ba57250f77e75fe1119dfff5/android.jar with input /Users/weidong/Library/Android/sdk/platforms/android-29/android.jar
Removed unused resources: Binary resource data reduced from 802KB to 744KB: Removed 7%
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 185.7s (!)
✓ Built build/app/outputs/apk/release/app-release.apk (28.6MB).
Successfully resolved, pit. . .