Android app need to be built twice to avoid crash -


i'm facing issue don't understand @ all. have android app crash upon entering settings (crash log below), first time built. issue discovered while investigating why f-droid builds "faulty", while own worked fine.

the steps reproduce following:

  1. rm -r ~/.gradle
  2. ./gradlew assemblerelease && adb install -r ...

the build completes here, apk not work.

  1. ./gradlew assemblerelease && adb install -r ...

the second build completes, time crash not present anymore. has idea why such problem happening?

the issue can reproduced project located here. crash triggered entering settings. here full stack trace:

android.view.inflateexception: binary xml file line #19: error inflating class preferencescreen @ android.support.v7.preference.preferenceinflater.createitem(unknown source) @ android.support.v7.preference.preferenceinflater.oncreateitem(unknown source) @ android.support.v7.preference.preferenceinflater.createitemfromtag(unknown source) @ android.support.v7.preference.preferenceinflater.inflate(unknown source) @ android.support.v7.preference.preferenceinflater.inflate(unknown source) @ android.support.v7.preference.preferencemanager.inflatefromresource(unknown source) @ android.support.v7.preference.preferencefragmentcompat.addpreferencesfromresource(unknown source) @ fr.kwiatkowski.apktrack.ui.settingsfragment.oncreatepreferences(unknown source) @ android.support.v7.preference.preferencefragmentcompat.oncreate(unknown source) @ fr.kwiatkowski.apktrack.ui.settingsfragment.oncreate(unknown source) @ android.support.v4.app.fragment.performcreate(unknown source) @ android.support.v4.app.fragmentmanagerimpl.movetostate(unknown source) @ android.support.v4.app.fragmentmanagerimpl.movefragmenttoexpectedstate(unknown source) @ android.support.v4.app.fragmentmanagerimpl.movetostate(unknown source) @ android.support.v4.app.backstackrecord.executeops(unknown source) @ android.support.v4.app.fragmentmanagerimpl.executeops(unknown source) @ android.support.v4.app.fragmentmanagerimpl.executeopstogether(unknown source) @ android.support.v4.app.fragmentmanagerimpl.removeredundantoperationsandexecute(unknown source) @ android.support.v4.app.fragmentmanagerimpl.execpendingactions(unknown source) @ android.support.v4.app.fragmentmanagerimpl$1.run(unknown source) @ android.os.handler.handlecallback(handler.java:725) @ android.os.handler.dispatchmessage(handler.java:92) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5227) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:511) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:795) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:562) @ dalvik.system.nativestart.main(native method) caused by: java.lang.nosuchmethodexception: <init> [class android.content.context, interface android.util.attributeset] @ java.lang.class.getconstructorormethod(class.java:460) @ java.lang.class.getconstructor(class.java:431) ... 29 more java.lang.nosuchmethodexception: <init> [class android.content.context, interface android.util.attributeset] @ java.lang.class.getconstructorormethod(class.java:460) @ java.lang.class.getconstructor(class.java:431) @ android.support.v7.preference.preferenceinflater.createitem(unknown source) @ android.support.v7.preference.preferenceinflater.oncreateitem(unknown source) @ android.support.v7.preference.preferenceinflater.createitemfromtag(unknown source) @ android.support.v7.preference.preferenceinflater.inflate(unknown source) @ android.support.v7.preference.preferenceinflater.inflate(unknown source) @ android.support.v7.preference.preferencemanager.inflatefromresource(unknown source) @ android.support.v7.preference.preferencefragmentcompat.addpreferencesfromresource(unknown source) @ fr.kwiatkowski.apktrack.ui.settingsfragment.oncreatepreferences(unknown source) @ android.support.v7.preference.preferencefragmentcompat.oncreate(unknown source) @ fr.kwiatkowski.apktrack.ui.settingsfragment.oncreate(unknown source) @ android.support.v4.app.fragment.performcreate(unknown source) @ android.support.v4.app.fragmentmanagerimpl.movetostate(unknown source) @ android.support.v4.app.fragmentmanagerimpl.movefragmenttoexpectedstate(unknown source) @ android.support.v4.app.fragmentmanagerimpl.movetostate(unknown source) @ android.support.v4.app.backstackrecord.executeops(unknown source) @ android.support.v4.app.fragmentmanagerimpl.executeops(unknown source) @ android.support.v4.app.fragmentmanagerimpl.executeopstogether(unknown source) @ android.support.v4.app.fragmentmanagerimpl.removeredundantoperationsandexecute(unknown source) @ android.support.v4.app.fragmentmanagerimpl.execpendingactions(unknown source) @ android.support.v4.app.fragmentmanagerimpl$1.run(unknown source) @ android.os.handler.handlecallback(handler.java:725) @ android.os.handler.dispatchmessage(handler.java:92) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5227) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:511) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:795) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:562) @ dalvik.system.nativestart.main(native method) 

for sake of completeness, here gradle information:

------------------------------------------------------------ gradle 3.3 ------------------------------------------------------------  build time:   2017-01-03 15:31:04 utc revision:     075893a3d0798c0c1f322899b41ceca82e4e134b  groovy:       2.4.7 ant:          apache ant(tm) version 1.9.6 compiled on june 29 2015 jvm:          1.8.0_131 (oracle corporation 25.131-b11) os:           linux 3.16.0-4-amd64 amd64 

i apologize asking such broad question. in advance help!

as @commonsware suggested, issue resolved disabling proguard release build. confirms source of problem, , work begin figure out if -keep option missing somewhere.

regarding reason why 2 subsequent builds not generate same apk, i'm afraid i'll never know.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -