Groupie: Upgrading to 2.0.0 from 2.0.0-alpha2 fails because of minSdkVersion 17 dependency

Created on 3 Jan 2018  路  14Comments  路  Source: lisawray/groupie

I've been using 2.0.0-alpha2 and upgraded to the final 2.0.0 with my project that supports api level 16. Now I can't build my project because I get the following error:

Error:Execution failed for task ':app:processStandardBetaDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 17 declared in library [com.xwray:groupie:2.0.0] /Users/coltonidle/.gradle/caches/transforms-1/files-1.1/groupie-2.0.0.aar/d6d373b79a4ea48/AndroidManifest.xml as the library might be using APIs not available in 16
    Suggestion: use a compatible library with a minSdk of at most 16,
        or increase this project's minSdk version to at least 17,
        or use tools:overrideLibrary="com.xwray.groupie" to force usage (may lead to runtime failures)

I didn't see anything in the release notes about this so I'm assuming it wasn't purposeful.

All 14 comments

My bad. You're right, it doesn't need 17! In the meantime, you can definitely use tools:override to force it with no ill effects, but I'll try to put out a point release ASAP

Thanks!

Now I can't get 2.0.0 to work. I stripped out all code and basically I just fail after these two scenarios.

  1. Upgrade from 2.0.0-alpha2 to 2.0.0 and changing my min sdk to 17
  2. Upgrade from 2.0.0-alpha2 to 2.0.0 and adding <uses-sdk tools:overrideLibrary="com.xwray.groupie"/> to my manifest

Didn't have this issue with alpha2.

The failure in this case is that my app just dies upon launching with a stack trace that changes depending on what activity is launched.

 Process: com.myapp.app, PID: 24031
                                                        java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; in class Landroid/support/v4/content/res/ResourcesCompat; or its super classes (declaration of 'android.support.v4.content.res.ResourcesCompat' appears in /data/app/com.myapp.app-zHDCg2pFslUyFmDwOGdrLg==/split_lib_dependencies_apk.apk:classes2.dex)
                                                            at android.support.v7.widget.TintTypedArray.getFont(TintTypedArray.java:119)
                                                            at android.support.v7.widget.AppCompatTextHelper.updateTypefaceAndStyle(AppCompatTextHelper.java:208)
                                                            at android.support.v7.widget.AppCompatTextHelper.loadFromAttributes(AppCompatTextHelper.java:110)
                                                            at android.support.v7.widget.AppCompatTextHelperV17.loadFromAttributes(AppCompatTextHelperV17.java:38)
                                                            at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:81)
                                                            at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:71)
                                                            at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103)
                                                            at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1024)
                                                            at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1081)
                                                            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772)
                                                            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
                                                            at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
                                                            at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
                                                            at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
                                                            at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
                                                            at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
                                                            at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
                                                            at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                                                            at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                            at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                            at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
                                                            at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
                                                            at com.myapp.app.LoginActivity.onCreate(LoginActivity.java:111)
                                                            at android.app.Activity.performCreate(Activity.java:6975)
                                                            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
                                                            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
                                                            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
                                                            at android.app.ActivityThread.-wrap11(Unknown Source:0)
                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
                                                            at android.os.Handler.dispatchMessage(Handler.java:105)
                                                            at android.os.Looper.loop(Looper.java:164)
                                                            at android.app.ActivityThread.main(ActivityThread.java:6541)
                                                            at java.lang.reflect.Method.invoke(Native Method)
                                                            at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

If I delete the dep on Groupie then my problem is fixed. No crash at runtime (at startup).

Pretty sure this crash is caused by a conflict between support lib versions. What's your app's targetSdk? What version of the support library are you using?

I didn't change anything in my code when going from 2.0.0-alpha2 to 2.0.0 (just restating it again in case my wording before was more confusing than helpful).

All of my version numbers are defined as follows:

    minSdkVersion = 16
    targetSdkVersion = 26
    compileSdkVersion = 26
    buildToolsVersion = '26.0.2'
    supportLibVersion = '26.1.0

Thanks! No, I didn't think you changed your project's version numbers. However, the 2.0.0 version of Groupie is targeting 27, which the pre-release versions weren't.

I may need to change the way I'm including the support library. I'll try to repro in a sample project tonight.

Great. Thanks so much Lisa! I'll try to repro in a slimmed down sample app as well as mine is pretty large at this point.

Found this message in my build.gradle

Found versions 27.0.2, 26.1.0. Examples include com.android.support:recyclerview-v7:27.0.2 and com.android.support:animated-vector-drawable:26.1.0 more...

I'm not targeting or using 27.* of anything (builds, sdk, compile, min, support libs). Running gradlew app:dependencies I can see that groupie brings in 27.0.2 of recyclerView.

yep, I can change the dependency to provided which should fix this

Great. I'll bump up my version numbers for the time being so that hopefully I can get past #140

@ColtonIdle if you're using Kotlin you may have lots of nullable / non-null issues upgrading to 27 (I know I did). simplest would be to force the version of the support lib in your build.grade

Nope. No Kotlin in this project (yet).

Hey, I consulted with some other open source people about the support lib conflict.

Apparently, the best practice is for my library to go ahead and specify the latest. If your project requires older versions, then your project should use a gradle resolution strategy to force the versions that you need.

Here's an example of keeping all the various support lib dependencies at the same level: https://github.com/JakeWharton/u2020/blob/af670f964a4750707d98cda31cfa95244eb3ec07/build.gradle#L105-L113

I will go ahead and publish a new version tonight with just the lower minSdk.

@ColtonIdle just wanted to update you. I'm having unrelated issues publishing the databinding and kotlin-android-extensions modules, but I did succeed in lowering the minSdk and publishing the main java artifact (the one you are using) to Maven at version 2.0.1. So feel free to go ahead and give it a try.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FabianTerhorst picture FabianTerhorst  路  6Comments

ValCanBuild picture ValCanBuild  路  6Comments

andhie picture andhie  路  3Comments

forntoh picture forntoh  路  3Comments

Nimrodda picture Nimrodda  路  3Comments