dim
dim copied to clipboard
flutter build apk 报错
FAILURE: Build failed with an exception.
- What went wrong: A problem occurred configuring root project 'dim'.
Could not resolve all files for configuration ':classpath'. Could not resolve com.android.tools.build:gradle:3.1.2. Required by: project : > Could not resolve com.android.tools.build:gradle:3.1.2. > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.pom'. > Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.pom'. > Connect to 127.0.0.1:12759 [/127.0.0.1] failed: Connection refused (Connection refused) > Could not resolve com.android.tools.build:gradle:3.1.2. > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.pom'. > Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.pom'. > Connect to 127.0.0.1:12759 [/127.0.0.1] failed: Connection refused (Connection refused)
-
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 0s
The plugin dim could not be built due to the issue above.
网络问题吧
我今天打包也遇到了这个问题我是这么解决的:
打开 External Libraries-->Flutter Plugins-->dim-0.2.8-->android-->gradle.wrapper-->打开 gradle-wrapper.properties文件,将 distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
修改为 distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
然后在打开 ..-->android-->build.gradle文件将
compileSdkVersion 27
defaultConfig {
minSdkVersion 16
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
修改为
compileSdkVersion 30
defaultConfig {
minSdkVersion 19
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
我通过这个方式修改源文件就可以编译正常,如果你还在用,希望可以帮到你