【发布时间】:2019-08-01 15:51:39
【问题描述】:
在尝试将我的项目迁移到 AndroidX 后,我遇到了很多问题,但仍然无法成功构建。
现在,当我尝试构建时,我收到以下错误:
Launching lib/main.dart on Android SDK built for x86 in debug mode...
* Error running Gradle:
ProcessException: Process "/Users/felipe/MYAPPANAME/android/gradlew" exited abnormally:
> Configure project :app
WARNING: minSdkVersion (21) is greater than targetSdkVersion (18) for variant "debug". Please change the values such that minSdkVersion is less than or equal to targetSdkVersion.
WARNING: minSdkVersion (21) is greater than targetSdkVersion (18) for variant "dynamicProfile". Please change the values such that minSdkVersion is less than or equal to targetSdkVersion.
WARNING: minSdkVersion (21) is greater than targetSdkVersion (18) for variant "release". Please change the values such that minSdkVersion is less than or equal to targetSdkVersion.
WARNING: minSdkVersion (21) is greater than targetSdkVersion (18) for variant "profile". Please change the values such that minSdkVersion is less than or equal to targetSdkVersion.
WARNING: minSdkVersion (21) is greater than targetSdkVersion (18) for variant "dynamicRelease". Please change the values such that minSdkVersion is less than or equal to targetSdkVersion.
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
> Configure project :camera
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':camera'.
> Could not resolve all artifacts for configuration ':camera:classpath'.
> Could not find com.com.MYAPPNAME.android.tools.build:gradle:3.3.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/com/MYAPPNAME/android/tools/build/gradle/3.3.0/gradle-3.3.0.pom
- https://dl.google.com/dl/android/maven2/com/com/MYAPPNAME/android/tools/build/gradle/3.3.0/gradle-3.3.0.jar
- https://jcenter.bintray.com/com/com/MYAPPNAME/android/tools/build/gradle/3.3.0/gradle-3.3.0.pom
- https://jcenter.bintray.com/com/com/MYAPPNAME/android/tools/build/gradle/3.3.0/gradle-3.3.0.jar
Required by:
project :camera
* 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 9s
Command: /Users/felipe/MYAPPNAME/android/gradlew app:properties
Please review your Gradle project setup in the android/ folder.
Exited (sigterm)
我的构建文件: app/build.gladle:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.MYAPPNAME.android"
minSdkVersion 21
targetSdkVersion 18
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// 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
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}
apply plugin: 'com.google.gms.google-services'
build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.2.0' //firebase
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我不知道我还能做什么,我看了很多关于配置文件的问题,但我还没有找到答案。
【问题讨论】: