提问者:小点点

为什么我得到:“保留空间是私有的”错误


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

我已经把它导入了android studio,我被告知它可以转换成自己的格式,我可以继续工作。

在抛出所有初始链接和版本兼容性错误后,我遇到了以下错误,无法通过:

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

不管怎样,这是一个合法的错误吗?

这是我的身材。格雷德尔:

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')
}

为了澄清这个问题:在莫森·贝娄的回答的帮助下,这个错误的解决方案是:

  1. 我已经根据Mohsen的回答改变了build.gradle内容,更新了旧的依赖关系并将编译更改为实现-错误消失了。
  2. 我已经按照这里的解决方案来消除我得到的第二个错误(资源整数/google_play_services_version)-参见波纹管。

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


共1个答案

匿名用户

价值观xml:643:error:resourceandroid:attr/preserveIconSpacing是私有的。

你使用的是私人资源,这就是这个问题出现的原因。

评论或删除该行将有助于继续。

更新:这里是修改后的版本。格雷德尔

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'

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

也可以使用实现而不是编译

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