Instant App module searches for resources in another not base module - android

I'm developing an Instant App, that has base module and 2 feature modules: feature1 and feature2. I'm getting strange crash when I'm trying to launch feature2 activity:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.myapp.qa/com.test.myapp.feature2.ui.activity.Feature2Activity}: android.view.InflateException: Binary XML file line #76: Binary XML file line #76: Error inflating class android.widget.ProgressBar
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
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:6540)
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)
Caused by: android.view.InflateException: Binary XML file line #76: Binary XML file line #76: Error inflating class android.widget.ProgressBar
Caused by: android.view.InflateException: Binary XML file line #76: Error inflating class android.widget.ProgressBar
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:650)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:723)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:791)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:733)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at com.test.myapp.ui.activity.base.BaseActivity.setContentView(BaseActivity.java:237)
at com.test.myapp.feature2.ui.activity.Feature2Activity.onCreate(Feature2Activity.java:123)
at android.app.Activity.performCreate(Activity.java:6980)
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:6540)
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)
Caused by: android.content.res.Resources$NotFoundException: Drawable com.test.myapp.qa:layout/random_feature1_layout with resource ID #0x82030011
E/AndroidRuntime: Caused by: android.content.res.Resources$NotFoundException: File res/layout/random_feature1_layout_fns.xml from drawable resource ID #0x82030011
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:754)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:598)
at android.content.res.Resources.loadDrawable(Resources.java:885)
at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:953)
at android.content.res.TypedArray.getDrawable(TypedArray.java:928)
at android.widget.ProgressBar.<init>(ProgressBar.java:281)
at android.widget.ProgressBar.<init>(ProgressBar.java:230)
at android.widget.ProgressBar.<init>(ProgressBar.java:226)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:650)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:723)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:791)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:733)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at com.test.myapp.ui.activity.base.BaseActivity.setContentView(BaseActivity.java:237)
at com.test.myapp.feature2.ui.activity.Feature2Activity.onCreate(Feature2Activity.java:123)
at android.app.Activity.performCreate(Activity.java:6980)
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:6540)
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)
Caused by: android.view.InflateException: Class not found LinearLayout
at android.graphics.drawable.DrawableInflater.inflateFromClass(DrawableInflater.java:220)
at android.graphics.drawable.DrawableInflater.inflateFromXmlForDensity(DrawableInflater.java:139)
at android.graphics.drawable.Drawable.createFromXmlInnerForDensity(Drawable.java:1295)
at android.graphics.drawable.Drawable.createFromXmlForDensity(Drawable.java:1254)
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:744)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:598) 
at android.content.res.Resources.loadDrawable(Resources.java:885) 
at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:953) 
at android.content.res.TypedArray.getDrawable(TypedArray.java:928) 
at android.widget.ProgressBar.<init>(ProgressBar.java:281) 
at android.widget.ProgressBar.<init>(ProgressBar.java:230) 
at android.widget.ProgressBar.<init>(ProgressBar.java:226) 
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:334) 
at android.view.LayoutInflater.createView(LayoutInflater.java:650) 
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) 
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:723) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:791) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:733) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:869) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:827) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:377) 
at com.test.myapp.ui.activity.base.BaseActivity.setContentView(BaseActivity.java:237) 
at com.test.myapp.feature2.ui.activity.Feature2Activity.onCreate(Feature2Activity.java:123) 
at android.app.Activity.performCreate(Activity.java:6980) 
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:6540) 
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) 
06-18 10:42:37.616 11607-11607/com.test.myapp.qa E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "LinearLayout" on path: DexPathList[[zip file "/data/app/com.test.myapp.qa-ncO99Ptagbu_PYoBeZhFeA==/base.apk", zip file "/data/app/com.test.myapp.qa-ncO99Ptagbu_PYoBeZhFeA==/split_feature2.apk", zip file "/data/app/com.test.myapp.qa-ncO99Ptagbu_PYoBeZhFeA==/split_feature1.apk"],nativeLibraryDirectories=[/data/app/com.test.myapp.qa-ncO99Ptagbu_PYoBeZhFeA==/lib/x86, /system/lib, /system/vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.graphics.drawable.DrawableInflater.inflateFromClass(DrawableInflater.java:201)
... 47
If we look at Feature2Activity layout file, line 76 we'll see:
<ProgressBar
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="right"
android:indeterminateDrawable="#drawable/progress" />
Drawable progress.xml is located in feature2 resources. If we remove it, or change it to some drawable from base resources, everything works fine.
Another strange thing is this line:
Caused by: android.content.res.Resources$NotFoundException: Drawable com.test.myapp.qa:layout/random_feature1_layout with resource ID #0x82030011
Layout random_feature1_layout is located at feature1 resources, and shouldn't be referenced at all. But if we go to feature2\R.java file, and look for progress.xml drawable we'll find:
public static final int progress=0x80030011;
And if you look closer you'll notice that progress's and random_feature1_layout's ids are differ by one digit: 0x80030011 and 0x82030011. So I made an assumption, that feature2 for unknown reasons looks for progress drawable in feature1 resources. I tried to remove feature1 dependency and crash disappeared, that confirms my assumption.
I should also note that this issue is observed only for Instant app. Installed app works fine.
My question is how is it possible that feature2 searches for resources in feature1 apk? Do you have any ideas what caused this behaviour or maybe hints how to debug this issue?

With reference to Google issue tracker, it has been fixed with Android SDK Built-Tools to 27.0.2
Please update your Android SDK Built-Tools to 27.0.2
And ensure you are on Android Studio 3.0.1 or newer.
If any issue persists, please report at Google issue tracker they will re-open to examine. Thanks!

Related

AGP 7.2 - java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal_3570298/Offline; for instrumentation tests

When running android instrumentation tests with AGP 7.2 (android studio chipmunk) I am seeing the following error:
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal_b6258fc/Offline;
at androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity.$jacocoInit(Unknown Source:13)
at androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity.<clinit>(Unknown Source:0)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.jacoco.agent.rt.internal_b6258fc.Offline" on path: DexPathList[[zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.abc.appname.develop.test-VAV8qDGNBpOvARX_Y9h_SA==/base.apk"],nativeLibraryDirectories=[/data/app/com.abc.appname.develop.test-VAV8qDGNBpOvARX_Y9h_SA==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity.$jacocoInit(Unknown Source:13) 
at androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity.<clinit>(Unknown Source:0) 
at java.lang.Class.newInstance(Native Method) 
at android.app.Instrumentation.newActivity(Instrumentation.java:1174) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
I have jacoco 0.8.8 setup as well, but when I turn debug.testCoverageEnabled to false, the instrumentation tests pass successfully.
Using jacoco 0.8.7 has the same issue, but both 0.8.7 and 0.8.8 work correctly on AGP 7.1.3 (bumblebee).

Android 12 Splash Screen causing crash in <12 versions of Android with AppBarLayout

I set the theme of the app to the one I created that inherits from Theme.SplashScreen, which is declared in values-v31. Now when I launch my app on devices running 11 and below, I get a crash. How do you customize the splash screen for 12 devices when your main app theme is Theme.MaterialComponents.DayNight.NoActionBar?
This is the stack trace for <12 devices.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.app/com.my.app.MyActivity}: android.view.InflateException: Binary XML file line #11: Binary XML file line #11: Error inflating class com.google.android.material.appbar.AppBarLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
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)
Caused by: android.view.InflateException: Binary XML file line #11: Binary XML file line #11: Error inflating class com.google.android.material.appbar.AppBarLayout
Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class com.google.android.material.appbar.AppBarLayout
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
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.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.my.app.databinding.ActivityMyBinding.inflate(ActivityMyBinding.java:66)
at com.my.app.MyActivity.onCreate(MyActivity.kt:55)
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)
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:243)
at com.google.android.material.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:213)
at com.google.android.material.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:148)
at com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(ThemeEnforcement.java:76)
at com.google.android.material.appbar.ViewUtilsLollipop.setStateListAnimatorFromAttrs(ViewUtilsLollipop.java:46)
at com.google.android.material.appbar.AppBarLayout.<init>(AppBarLayout.java:215)
at com.google.android.material.appbar.AppBarLayout.<init>(AppBarLayout.java:199)
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:334) 
at android.view.LayoutInflater.createView(LayoutInflater.java:647) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) 
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.inflate(LayoutInflater.java:515) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
at com.my.app.databinding.ActivityMyBinding.inflate(ActivityMyBinding.java:66) 
at com.my.app.MyActivity.onCreate(MyActivity.kt:55) 
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) 

"Error inflating class com.androidplot.xy.XYPlot" when I try to inflate my graph Fragment

When I debug my android app and I try to open my graph fragment, my app crashes. I put the "androidplot-core-1.5.7.aar" library in my "libs" project folder and implement it in my "build.gradle" dependencies.
I don't have this issue with the "androidplot-core-1.2.1.aar" library.
here is the graph fragment xml code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ap="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.androidplot.xy.XYPlot
android:id="#+id/imuPlot"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
style="#style/APDefacto.Light"/>
</LinearLayout>
Here is what it shows when I want to show a graph fragment and debug crashes :
--------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.poc2.irisa.plugandpos.poc2, PID: 5048
android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class com.androidplot.xy.XYPlot
Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.androidplot.xy.XYPlot
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at com.poc2.irisa.plugandpos.poc2.o.a(:52)
at android.support.v4.app.m.b(:2346)
at android.support.v4.app.z.a(:1428)
at android.support.v4.app.z.h(:1759)
at android.support.v4.app.z.a(:1827)
at android.support.v4.app.d.c(:797)
at android.support.v4.app.z.a(:2596)
at android.support.v4.app.z.b(:2383)
at android.support.v4.app.z.c(:2338)
at android.support.v4.app.z.p(:2245)
at android.support.v4.app.t.run(:703)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6120)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/halfhp/fig/Fig;
at com.androidplot.Plot.a(:561)
at com.androidplot.Plot.a(:403)
at com.androidplot.Plot.<init>(:324)
at com.androidplot.xy.XYPlot.<init>(:143)
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:430) 
at android.view.LayoutInflater.createView(LayoutInflater.java:645) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 
at com.poc2.irisa.plugandpos.poc2.o.a(:52) 
at android.support.v4.app.m.b(:2346) 
at android.support.v4.app.z.a(:1428) 
at android.support.v4.app.z.h(:1759) 
at android.support.v4.app.z.a(:1827) 
at android.support.v4.app.d.c(:797) 
at android.support.v4.app.z.a(:2596) 
at android.support.v4.app.z.b(:2383) 
at android.support.v4.app.z.c(:2338) 
at android.support.v4.app.z.p(:2245) 
at android.support.v4.app.t.run(:703) 
at android.os.Handler.handleCallback(Handler.java:751) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6120) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.halfhp.fig.Fig" on path: DexPathList[[zip file "/data/app/com.poc2.irisa.plugandpos.poc2-1/base.apk"],nativeLibraryDirectories=[/data/app/com.poc2.irisa.plugandpos.poc2-1/lib/arm, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.androidplot.Plot.a(:561) 
at com.androidplot.Plot.a(:403) 
at com.androidplot.Plot.<init>(:324) 
at com.androidplot.xy.XYPlot.<init>(:143) 
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:430) 
at android.view.LayoutInflater.createView(LayoutInflater.java:645) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 
at com.poc2.irisa.plugandpos.poc2.o.a(:52) 
at android.support.v4.app.m.b(:2346) 
at android.support.v4.app.z.a(:1428) 
at android.support.v4.app.z.h(:1759) 
at android.support.v4.app.z.a(:1827) 
at android.support.v4.app.d.c(:797) 
at android.support.v4.app.z.a(:2596) 
at android.support.v4.app.z.b(:2383) 
at android.support.v4.app.z.c(:2338) 
at android.support.v4.app.z.p(:2245) 
at android.support.v4.app.t.run(:703) 
at android.os.Handler.handleCallback(Handler.java:751) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6120) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'
Thanks in advance.
Best regards,
Malo
Just answering for myself after finding the question having had the same issue.
I had to add the following to my "build.gradle" dependencies.
implementation "com.halfhp.fig:figlib:1.0.7"

AuthUI.IdpConfig.EmailBuilder() inflate view error

I need to use firebase-ui-auth in my programm...
// Choose authentication providers
List providers = Arrays.asList(
new AuthUI.IdpConfig.EmailBuilder().build(),
new AuthUI.IdpConfig.GoogleBuilder().build());
// Create and launch sign-in intent
caller.startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(providers)
.build(),
RC_SIGN_IN);`
and function very good (I call this in my mainActivity)...
but, when I choose only: AuthUI.IdpConfig.EmailBuilder() the app crashes, because there is some problem to inflate xml...
error code:
Process: com.superena.superenaactivity, PID: 6516
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.superena.superenaactivity/com.firebase.ui.auth.ui.email.EmailActivity}: android.view.InflateException: Binary XML file line #24: Binary XML file line #24: Error inflating class android.support.design.widget.TextInputLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #24: Binary XML file line #24: Error inflating class android.support.design.widget.TextInputLayout
Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class android.support.design.widget.TextInputLayout
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
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 com.firebase.ui.auth.ui.email.CheckEmailFragment.onCreateView(CheckEmailFragment.java:89)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2335)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1423)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1754)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1822)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2591)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2378)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2333)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2240)
at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3243)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:3195)
at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:195)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:596)
at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:177)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1334)
at android.app.Activity.performStart(Activity.java:7029)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2741)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
06-27 12:54:24.320 6516-6516/com.superena.superenaactivity E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NoSuchFieldError: No static field error_color_material of type I in class Landroid/support/v7/appcompat/R$color; or its superclasses (declaration of 'android.support.v7.appcompat.R$color' appears in /data/app/com.superena.superenaactivity-reFM-WL6EH7D2KJRxYTXFw==/split_lib_slice_2_apk.apk)
at android.support.design.widget.TextInputLayout.setErrorEnabled(TextInputLayout.java:654)
at android.support.design.widget.TextInputLayout.<init>(TextInputLayout.java:257)
at android.support.design.widget.TextInputLayout.<init>(TextInputLayout.java:187)
... 40 more
with the two options it works very well; with only new AuthUI.IdpConfig.EmailBuilder().build());don't functions, if somebody can help me, please
I face same problem. Solved it by adding this
compile 'com.android.support:design:28.0.0'
into dependencies of app level gradle file.

Android Architecture Navigation component and Proguard results in java.lang.ClassNotFoundException

When running a proguard enabled build with the new android navigation component, my fragment class cannot be found. I receive this stack trace:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.myapppackage.path, PID: 24334
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapppackage.path/com.myapppackage.path.MainActivity}: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class fragment
Caused by: java.lang.RuntimeException: Exception inflating com.myapppackage.path:navigation/nav_graph line 7
at androidx.navigation.h.a(Unknown Source:124)
at androidx.navigation.c.a(Unknown Source:4)
at androidx.navigation.fragment.NavHostFragment.a(Unknown Source:88)
at android.support.v4.app.g.k(Unknown Source:15)
at android.support.v4.app.m.a(Unknown Source:382)
at android.support.v4.app.m.b(Unknown Source:7)
at android.support.v4.app.m.a(Unknown Source:74)
at android.support.v4.app.m.onCreateView(Unknown Source:216)
at android.support.v4.app.j.a(Unknown Source:4)
at android.support.v4.app.h.a(Unknown Source:2)
at android.support.v4.app.e.onCreateView(Unknown Source:0)
at android.support.v4.app.h.onCreateView(Unknown Source:0)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
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.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.j.b(Unknown Source:23)
at android.support.v7.app.c.setContentView(Unknown Source:4)
at com.myapppackage.path.MainActivity.onCreate(Unknown Source:6)
at android.app.Activity.performCreate(Activity.java:6999)
at android.app.Activity.performCreate(Activity.java:6990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.myapppackage.path.ui.start.StartFragment
at androidx.navigation.fragment.a$a.a(Unknown Source:58)
at androidx.navigation.fragment.a$a.a(Unknown Source:19)
at androidx.navigation.h.a(Unknown Source:16)
at androidx.navigation.h.a(Unknown Source:133)
at androidx.navigation.h.a(Unknown Source:31)
at androidx.navigation.c.a(Unknown Source:4) 
at androidx.navigation.fragment.NavHostFragment.a(Unknown Source:88) 
at android.support.v4.app.g.k(Unknown Source:15) 
at android.support.v4.app.m.a(Unknown Source:382) 
at android.support.v4.app.m.b(Unknown Source:7) 
at android.support.v4.app.m.a(Unknown Source:74) 
at android.support.v4.app.m.onCreateView(Unknown Source:216) 
at android.support.v4.app.j.a(Unknown Source:4) 
at android.support.v4.app.h.a(Unknown Source:2) 
at android.support.v4.app.e.onCreateView(Unknown Source:0) 
at android.support.v4.app.h.onCreateView(Unknown Source:0) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780) 
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.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.j.b(Unknown Source:23) 
at android.support.v7.app.c.setContentView(Unknown Source:4) 
at com.myapppackage.path.MainActivity.onCreate(Unknown Source:6) 
at android.app.Activity.performCreate(Activity.java:6999) 
at android.app.Activity.performCreate(Activity.java:6990) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
Caused by: java.lang.ClassNotFoundException: com.myapppackage.path.ui.start.StartFragment
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
E/AndroidRuntime: at androidx.navigation.fragment.a$a.a(Unknown Source:45)
... 38 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.myapppackage.path.ui.start.StartFragment" on path: DexPathList[[zip file "/data/app/com.myapppackage.path-yqk9eOoCoeyT3xg78oYcxg==/base.apk"],nativeLibraryDirectories=[/data/app/com.myapppackage.path-yqk9eOoCoeyT3xg78oYcxg==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 41 more
It says it cannot find the fragment class which is defined in my nav_graph.xml file:
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.myapppackage.path.ui.start.StartFragment
My nav_graph.xml:
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
app:startDestination="#id/start">
<fragment
android:id="#+id/start"
android:name="com.myapppackage.path.ui.start.StartFragment"
android:label="start_fragment"
tools:layout="#layout/start_fragment" />
</navigation>
As you can see the name of the fragment is set in the xml, this path seems to become invalid after running through proguard.
My only work-around so far is to define each of my fragment class paths as -keepnames in my proguard-rules.pro file. For example:
-keepnames class com.myapppackage.path.ui.start.StartFragment
After this, the obfuscated compile runs fine without crashing.
Although I'm not sure if this is correct, am I doing something wrong?
How can we use the new navigation architecture component with our obfuscated builds without defining a rule for each fragment in proguard rules?
I understand this issue may only be a problem right now because the navigation-fragment component is still in alpha.

Categories

Resources