gpt4 book ai didi

android - 为什么我得到 : "preserveIconSpacing is private" error

转载 作者:太空狗 更新时间:2023-10-29 13:03:01 26 4
gpt4 key购买 nike

我拿了我的一个旧的 android 项目,它是几年前在 eclipse Luna 上开发的,并试图恢复它。

我已经将它导入到 android studio 中,有人告诉我可以将它转换成它自己的格式,这样我就可以继续工作了。

在抛出所有初始链接和版本兼容性错误之后,我陷入了以下错误并且无法通过它:

c:\....\MyProjectFolder\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:643: error: resource android:attr/preserveIconSpacing is private.

有什么办法解决这个问题还是合法错误?

这是我的build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "28.0.3"

defaultConfig {
applicationId "com.eibimalul.smartgallery"
minSdkVersion 16
targetSdkVersion 22
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile 'com.android.support:gridlayout-v7:19.1.0'
compile 'com.android.support:appcompat-v7:19.1.0'
compile files('libs/robobinding-0.8.3-jar-with-dependencies.jar')
compile files('libs/simple-xml-2.7.1.jar')
compile files('libs/universal-image-loader-1.9.2.jar')
}

只是清除解决方案:在下面 Mohsen 的回答的帮助下,该错误的解决方案是:

  1. 我已经按照 Mohsen 的回答更改了 build.gradle 的内容,更新了旧的依赖项并将编译更改为实现 - 错误消失了。
  2. 我已遵循解决方案 here消除我遇到的第二个错误(资源整数/google_play_services_version)- 见下文。

我现在有第三个错误,但它似乎与第一个错误无关,所以我相信主要问题已解决。

最佳答案

values.xml:643: error: resource android:attr/preserveIconSpacing is private.

您正在使用私有(private)资源,这就是出现此问题的原因。

注释该行或删除它将有助于继续。


更新:这是更改后的build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion "28.0.3"

defaultConfig {
applicationId "com.eibimalul.smartgallery"
minSdkVersion 16
targetSdkVersion 28
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation files('libs/robobinding-0.8.3-jar-with-dependencies.jar')
implementation files('libs/simple-xml-2.7.1.jar')
implementation files('libs/universal-image-loader-1.9.2.jar')
}

我只是更改了 appcompatcompileSdkVersion 等的版本以更新它们。此外,如果这没有帮助,因为这些库已经足够旧(例如日期(2013 年 7 月 8 日)),也许您应该用最新的依赖项替换它们。

例如,添加:

implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'

而不是 compile files('libs/universal-image-loader-1.9.2.jar') 因为它可以从在线存储库下载库,你不需要手动添加它们.

同样使用implementation代替compile

如果错误仍然出现,请检查此链接并以这种方式添加 simple-xml:https://stackoverflow.com/a/19455878/4409113

关于android - 为什么我得到 : "preserveIconSpacing is private" error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52912763/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com