Gradle and Android v7 compat issue

后端 未结 2 1985
旧时难觅i
旧时难觅i 2021-01-16 17:50

I have problems compiling my Android app with Gradle. I\'m a newbie with Gradle, so...

It seems that Gradle cannot resolve correctly v7 compat library. This is the c

相关标签:
2条回答
  • 2021-01-16 18:43

    Finally, I found the issue, thanks to for3st.

    Well, I didn't know that Android Studio SDK Manager and the SDK Manager that I downloaded on my own from the android web page did not refer to the following. That's the main issue here. Other issues were related to the problem:

    • I had such an old version of Android Studio (0.2) that I had to upgrade manually with the zip installer applying the patch. It seemed to work fine, but I'm not absolutely sure, so I uninstalled it and installed Android Studio 3.2 from the android developer site, then used the IDE mechanism to upgrade to 3.6. From now on, I'll enjoy easier upgrades.
    • Then I got lots of issues with Gradle, related to the version and all that, so I downloaded from the Gradle site the 1.8 version, placed somewhere in my disk, edited Android Studio settings to use this and edited the "gradle-wrapper.properties" to use the proper version.
    • More issues I got were due to downloading the required API versions that I targeted in my project, as well as matching the minSdkVersion and targetSdkVersion in AndroidManifest.xml and gradle.build files.
    • Then I checked my project structure and made the correct adjustments or added the "sourceSets" section in my build.gradle files.
    • Finally, I copied my third party dependencies (joda.time, android.v4 support) to my lib folder.

    I'm not sure which one solved the issue, but all of this solved it for sure. I decided to put all this in order to help someone who gets stucked. Use this as a checklist.

    0 讨论(0)
  • 2021-01-16 18:51

    Problem is probably the missing appcompat repo in your Android SDK.

    Probably you are using 2 instances of gradle and Android SDK. Android Studio comes bundled with it's own Android SDK, so updating this wont change your previous installed one. Also normally you would start a Gradle project in Android Studio with a Gradle-Wrapper that handles manageing the gradle instance on its own (usually it will get downloaded into your %USER%/.gradle folder)

    I also guess you downloaded gradle and that instance is what you use through the commandline. So to fix this just update your none-android studio android sdk (also check all the repos)

    More to the Issue: Android Library Projects won't get bundled as a jar since they need additional resources. The format for this is AAR, which to my knowledge cannot be build directly as for now. Also the gradle android plugin does not work with local AARs, only from maven/ivy repositories (this is a design descion and on purpose)

    0 讨论(0)
提交回复
热议问题