我正在移植我当前的android apk,以满足最近的playstore指令-“targetSdkVersion 26”
这是我的年级档案。我从CompilesDKVersion26开始,到28。所以对于28个,我不得不使用AndroidX依赖项。我在主题行中贴出的错误处卡住了。任何帮助都将不胜感激。
错误消息为
AGPBI: {"kind":"error","text":"error: duplicate value for resource \u0027attr/actionBarSize\u0027 with config \u0027\u0027.","sources":[{"file":"/Users/sk/.gradle/caches/transforms-1/files-1.1/appcompat-1.0.0.aar/34c8fa33903fb2b3203e5c70952da588/res/values/values.xml","position":{"startLine":1303,"startColumn":4,"startOffset":70911,"endColumn":68,"endOffset":70975}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: resource previously defined here.","sources":[{"file":"/Users/sk/.gradle/caches/transforms-1/files-1.1/appcompat-1.0.0.aar/34c8fa33903fb2b3203e5c70952da588/res/values/values.xml","position":{"startLine":1303,"startColumn":4,"startOffset":70911,"endColumn":68,"endOffset":70975}}],"original":"","tool":"AAPT"}
:app:mergeDebugResources
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "pack.age.net"
minSdkVersion 16
//Since no updates to app can be published in Playstore beginning Nov 1, 2018 - bumping targetSdk to 26 from 19
targetSdkVersion 26
//Double check this before you move this to production
versionCode 22
versionName "3.3"
// Enabling multidex support.
multiDexEnabled true
//Language resources
resConfigs "en", "hi"
}
buildTypes {
release {
//Shrink your code
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
lintOptions {
checkReleaseBuilds false
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
repositories {
mavenCentral()
maven {
url "http://dl.bintray.com/journeyapps/maven"
}
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
//implementation 'com.android.support:support-v4:28.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
// implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
// implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
//Hockey App for Crash Analytics
implementation 'net.hockeyapp.android:HockeySDK:5.1.1'
//Sundry library files
implementation files('libs/commons-codec-1.9.jar')
implementation files('libs/ksoap2-android-assembly-3.6.0-jar-with-dependencies.jar')
implementation files('libs/libphonenumber-6.2.jar')
//Mutlidex Support
implementation 'com.android.support:multidex:1.0.0'
//Square Picasso Image View
implementation 'com.squareup.picasso:picasso:2.5.2'
//Calligraphy for custom fonts
implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
testImplementation 'junit:junit:4.12'
//Apache Commons
implementation 'org.apache.commons:commons-lang3:3.7'
implementation 'com.github.chrisbanes:PhotoView:2.2.0'
// Supports Android 4.0.3 and later (API level 15)
implementation 'com.journeyapps:zxing-android-embedded:2.0.1@aar'
// Supports Android 2.1 and later (API level 7), but not optimal for later Android versions.
// If you only plan on supporting Android 4.0.3 and up, you don't need to include this.
implementation 'com.journeyapps:zxing-android-legacy:2.0.1@aar'
// Convenience library to launch the scanning and encoding Activities.
// It automatically picks the best scanning library from the above two, depending on the
// Android version and what is available.
implementation 'com.journeyapps:zxing-android-integration:2.0.1@aar'
// Version 3.0.x of zxing core contains some code that is not compatible on Android 2.2 and earlier.
// This mostly affects encoding, but you should test if you plan to support these versions.
// Older versions e.g. 2.2 may also work if you need support for older Android versions.
implementation 'com.google.zxing:core:3.0.1'
//Firebase
implementation 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
正确的解决办法可能是更新Firebase依赖项,使其具有已经使用AndroidX
依赖项的版本,如果这还不够,还可以启用Jetfier,以防其他库引入com.Android.support
依赖项,这些依赖项需要重新编写。为此,将其添加到gradle.properties
文件中:
android.enableJetifier=true
android.useAndroidX=true
我运行我的项目,显示: 错误:配置为“”的资源“attr/content”的值重复。消息{kind=error,text=error:资源'attr/content'的值与配置为''重复。sources=[/users/bobzheng/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/805CD07C22A7F63B737
/users/hyun/desktop/laftel-android/app/build/immeditiates/increment/mergedbugresources/merged.dir/values/values.xml重复资源'attr/font'与config“.resource的值。 executionException:com.android.tools.appt2.aapt2E
我已经无法构建可以成功构建的android项目。 构建:同步 ../../.../..gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.0.aar/079f027781f9663d188d9dd5f4f897cd/res/values/values.xml 错误:配置为“”的资源“attr/tint”的值重复。错误:资源以前定义在这里。
我使用的是android studion 3.4.1(最新版本)。我已经导入了一个项目,它需要:Android SDK v23 Android构建工具v23.0.2 Android Support Repository v23.3.0 我已经完成了所有需要的更新,但现在运行程序时,我面临着这个问题。
我已经调试了3天,但仍然无法解决它。如果你们中有人对问题的根源和我该如何解决问题有一些想法,那我会很高兴的?原谅我,我不知道有什么更好的方法来粘贴错误信息。 错误日志: