android / android/app-bundle-samples

Resource Not Found Relaunch Application on-Demand Dynamic Feature Module

Offen
#116 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C++
Sterne
735
Forks
348
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

When I download the on demand dynamic feature module it works fine as soon as I restart application I get the crash "Resource not found" .
Heres the code that i copied from google dynamic features[ sample repo](https://github.com/googlearchive/android-dynamic-features)

```
private fun onSuccessfulLoad(moduleName: String, launch: Boolean) {
if (launch) {
when (moduleName) {
pagesfeatures -> launchActivity(mainActivity)
}
}

}
```
I have already overridden the code in BaseActivity and App class

```
open class BaseActivity: AppCompatActivity() {
override fun attachBaseContext(newBase: Context?) {
super.attachBaseContext(newBase)
SplitCompat.install(this)
}
}
public class App extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
SplitCompat.install(base);
}
}
```

But its crashing when i revisit the application

The Exception thats occurring in my logs Crashlytics

> Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.qp.readquranoffline.holybookreading/com.mycode.pagesfeature.activities.MainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7e010000
> at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3621)
> at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3866)
> at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
> at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
> at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
> at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2190)
> at android.os.Handler.dispatchMessage(Handler.java:106)
> at android.os.Looper.loop(Looper.java:268)
> at android.app.ActivityThread.main(ActivityThread.java:8004)
> at java.lang.reflect.Method.invoke(Method.java)
> at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:627)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)
>
> Caused by android.content.res.Resources$NotFoundException: Resource ID #0x7e010000
> at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:248)
> at android.content.res.Resources.loadXmlResourceParser(Resources.java:2400)
> at android.content.res.Resources.getAnimation(Resources.java:1277)
> at android.view.animation.AnimationUtils.loadAnimation(AnimationUtils.java:138)
> at com.mycode.quranpagesfeature.activities.MainActivity.onCreate(MainActivity.kt:158)
> at android.app.Activity.performCreate(Activity.java:8058)
> at android.app.Activity.performCreate(Activity.java:8042)
> at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1315)
> at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3594)
> at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3866)
> at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
> at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
> at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
> at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2190)
> at android.os.Handler.dispatchMessage(Handler.java:106)
> at android.os.Looper.loop(Looper.java:268)
> at android.app.ActivityThread.main(ActivityThread.java:8004)
> at java.lang.reflect.Method.invoke(Method.java)
> at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:627)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne bei MainActivity.kt:158, wo AnimationUtils.loadAnimation nach dem erneuten Start der App Resources$NotFoundException auslöst. Überprüfe das Beispiel für dynamische Features sowie die gezeigten Implementierungen von BaseActivity und App attachBaseContext und reproduziere den Neustartablauf mit installiertem Feature. Als erledigt gilt die Aufgabe, wenn die Feature-Aktivität nach dem erneuten Start ohne den Missing-Resource-Absturz gestartet wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
android, kotlin
Bereich
build-system, mobile
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.