4

I took an old android project of mine, that was developed on eclipse Luna few years back and tried to revive it.

I have imported it into android studio which I was told can convert it into it's own format and I would be able to continue working on.

After going threw all the initial linking and versions compatibility errors, I got stuck on the following error and cannot get passed it:

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

Any way around this or is it a legit error?

Here is my 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')
}

Just to clear the solution: The solution for that error with the great help of the answer of Mohsen bellow was:

  1. I have changed the build.gradle content following Mohsen's answer bellow, updating old dependencies and changing compile to implementation - error is gone.
  2. I have followed the solution here to eliminate the second error I have got (resource integer/google_play_services_version) - see bellow.

I now have a third error but it seems not related to the first one, so I believe the main issue was resolved.

Eibi
  • 402
  • 4
  • 17
  • I gotta say. Thanks for following the community rules. :) Please let me know if you created another question with any issues so that I can help you with that. – ʍѳђઽ૯ท Oct 21 '18 at 14:01

1 Answers1

4

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

You are using a private resource that's why this issue came up.

Commenting that line or removing it will help to proceed.


Update: Here is the changed 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')
}

I simply changed the versions of the appcompat and compileSdkVersion and etc in order to update them. Also, if this didn't help, since those libraries are old enough (Date(Jul 08, 2013) e.g.) perhaps you should replace them with the newest dependencies.

For example, add:

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

Instead of compile files('libs/universal-image-loader-1.9.2.jar') since it can download the libraries from online repositories and you don't need to add them manually.

Also use implementation instead of compile.

If the error still show up, check this link and add the simple-xml that way: https://stackoverflow.com/a/19455878/4409113

ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108
  • 1
    That's the thing, the attribute: "preserveIconSpacing" is not mine. It is probably auto generated or came with a template. – Eibi Oct 21 '18 at 07:42
  • You can search for it. Search the whole project and try to delete `build` directory. Then rebuild the project again to see the result. Also, check this link: https://stackoverflow.com/a/51207575/4409113 – ʍѳђઽ૯ท Oct 21 '18 at 07:43
  • 1
    Thanks for the help Mohsen ;). I have erased the build and rebuilt the project - no luck. The thread you linked did not give a working answer either.. – Eibi Oct 21 '18 at 08:37
  • Perhaps it's coming from one of the dependencies *which is pretty old* since you said: `that was developed on eclipse Luna few years back`. So in this case, I'd add my app `build.gradle` file dependencies to the question to see which one causes an issue. You can however try updating them. This seems to be a runtime issue if you couldn't find that attribute so it's mostly coming from added dependencies - libraries. – ʍѳђઽ૯ท Oct 21 '18 at 08:40
  • I have added the build.gradle content to the original post. – Eibi Oct 21 '18 at 10:33
  • 1
    Check my updated answer. Those are pretty old. No surprise. – ʍѳђઽ૯ท Oct 21 '18 at 11:14
  • OK, so I edited the build.gradle as you advised and a new first error has now poped up. I don't know if the original error was resolved or just pushed forward due to the new error: c:\...\MyProjectFolder\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml:36: error: resource integer/google_play_services_version (aka com.eibimalul.smartgallery:integer/google_play_services_version) not found. – Eibi Oct 21 '18 at 11:50
  • 1
    Yes seems like that error is gone. Check this link: https://stackoverflow.com/questions/52014773/error-resource-integer-google-play-services-version-aka-appinteger-google-pla It's looking for an integer which couldn't found. – ʍѳђઽ૯ท Oct 21 '18 at 11:55
  • I am not sure if I should open a new Question thread on each error I get next, please tell me if I do. Anyway, I am now getting an error of a missing google-services.json file.. :( – Eibi Oct 21 '18 at 12:28
  • Upgrading a project which is written years ago by Eclipse will have lots of issues like depreciated methods, not working behaviors or issues like this. However, try cleaning project or rebuild the project again. `missing google-services.json` happens when you use a dependency which will needs this. I suggest creating a new project and re-coding again (And you already got the context with the old project) since these will not be the only issues. Like I said, depreciated methods, not working behaviors and etc :) – ʍѳђઽ૯ท Oct 21 '18 at 12:33