android / android/app-bundle-samples

Resource Not Found Relaunch Application on-Demand Dynamic Feature Module

オープン
#116 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
735
フォーク
348
PR マージ指標
30日以内にマージされた PR はありません

説明

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)

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

MainActivity.kt:158 から始めます。ここでは、アプリを再起動した後に AnimationUtils.loadAnimation が Resources$NotFoundException を発生させます。dynamic feature のサンプルと、示されている BaseActivity および App の attachBaseContext 実装を確認し、feature をインストールした状態で再起動フローを再現してください。再起動後に missing-resource クラッシュが発生せず feature activity が起動すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, kotlin
領域
build-system, mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。