flutter - gradle中的问题
问题描述
我的minSDk版本第一次有问题所以我改到26,所以开始出现很多问题,关于cloud_firestore,video_player版本,所以我降级了版本并且错误改变了,现在我已经开始了有像“txt.something it's missing”这样的包错误,所以我添加了这个代码:我还将我的编译sdkVersion更改为28
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
}
现在它给了我这个错误:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'androidx.fragment:fragment' has different version for the compile (1.0.0-rc01) and runtime (1.1.0-alpha04) classpath. You should manually set the same version via DependencyResolution
所以我添加了:在我的 gradle 中,但开始给我这个错误的循环,不同的库有不同的版本
configurations.all {
resolutionStrategy {
force 'androidx.fragment:fragment:v4:1.1.0-alpha04'
}
}
我还尝试将我的 com.google.gms:google-services 设置为 3.2.1,添加代码:
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "26.1.0"
}
}
}
}
并添加我的 gradle.properties:
android.useAndroidX=true
android.enableJetifier=true
我的应用程序/build.gradle:
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
configurations.all {
resolutionStrategy {
}
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.gacitua.catilholi.goodstart"
minSdkVersion 26
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
}
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 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'
gradle/build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:3.2.1'
}
}
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
}
解决方案
推荐阅读
- c# - 在 Windows Docker 映像中使用 Console.Clear()?
- swift - 如何保护文本文件中的音频样本 --> Swift
- python - Pandas - Fillna 或 where 基于条件的函数
- karate - 空手道 UI:是否可以将具有用纯英语编写的场景的单独文件映射到空手道功能文件
- javascript - 有没有办法在解构对象时访问对象本身?
- javascript - 更改格式为“key=value&...”的字符串中的所有值
- excel - Excel时间计算在0时抛出错误
- node.js - 我的道具被传递给我的组件,但我无法找出正确的路径
- html - 如何在图像上叠加文本和按钮
- javascript - 如何在 DevTools 控制台中以编程方式模拟输入