Launch new, external Activity, from Flutter android MainActivity - android

I'm trying to write some native code in my Flutter app to integrate with Zendesk using their SDK. Thus far, my Flutter app has not required me to drop down and write any actual native code, so I'm getting a bit stuck here. What I have looks like this:
public class MainActivity extends FlutterActivity {
private static final String ZENDESK_CHANNEL = "zendesk";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
new MethodChannel(getFlutterView(), ZENDESK_CHANNEL).setMethodCallHandler(
this::invokeZendesk);
}
private void invokeZendesk(MethodCall call, MethodChannel.Result result) {
if (call.method.equals("init")) {
Zendesk.INSTANCE.init(this, "https://myapp.zendesk.com",
"myappid",
"myclientid");
Identity identity = new AnonymousIdentity();
Zendesk.INSTANCE.setIdentity(identity);
Support.INSTANCE.init(Zendesk.INSTANCE);
} else if (call.method.equals("launch")) {
RequestActivity.builder().show(this);
}
}
...
When I invoke the "launch" code I get this error:
E/AndroidRuntime(18326): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mypackage.myapp/zendesk.support.request.RequestActivity}: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class com.google.android.material.appbar.AppBarLayout
E/AndroidRuntime(18326): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
E/AndroidRuntime(18326): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
E/AndroidRuntime(18326): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
E/AndroidRuntime(18326): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
E/AndroidRuntime(18326): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
E/AndroidRuntime(18326): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
E/AndroidRuntime(18326): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(18326): at android.os.Looper.loop(Looper.java:193)
E/AndroidRuntime(18326): at android.app.ActivityThread.main(ActivityThread.java:6669)
E/AndroidRuntime(18326): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(18326): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/AndroidRuntime(18326): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/AndroidRuntime(18326): Caused by: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class com.google.android.material.appbar.AppBarLayout
E/AndroidRuntime(18326): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class com.google.android.material.appbar.AppBarLayout
E/AndroidRuntime(18326): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime(18326): at java.lang.reflect.Constructor.newInstance0(Native Method)
E/AndroidRuntime(18326): at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
E/AndroidRuntime(18326): at android.view.LayoutInflater.createView(LayoutInflater.java:647)
E/AndroidRuntime(18326): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
E/AndroidRuntime(18326): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
E/AndroidRuntime(18326): at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
E/AndroidRuntime(18326): at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
E/AndroidRuntime(18326): at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
E/AndroidRuntime(18326): at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
E/AndroidRuntime(18326): at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
E/AndroidRuntime(18326): at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
E/AndroidRuntime(18326): at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
E/AndroidRuntime(18326): at zendesk.support.request.RequestActivity.onCreate(RequestActivity.java:85)
E/AndroidRuntime(18326): at android.app.Activity.performCreate(Activity.java:7136)
E/AndroidRuntime(18326): at android.app.Activity.performCreate(Activity.java:7127)
E/AndroidRuntime(18326): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
E/AndroidRuntime(18326): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
E/AndroidRuntime(18326): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
E/AndroidRuntime(18326): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
E/AndroidRuntime(18326): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
E/AndroidRuntime(18326): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
E/AndroidRuntime(18326): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
E/AndroidRuntime(18326): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(18326): at android.os.Looper.loop(Looper.java:193)
E/AndroidRuntime(18326): at android.app.ActivityThread.main(ActivityThread.java:6669)
E/AndroidRuntime(18326): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(18326): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/AndroidRuntime(18326): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/AndroidRuntime(18326): Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
E/AndroidRuntime(18326): at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:221)
E/AndroidRuntime(18326): at com.google.android.material.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:196)
E/AndroidRuntime(18326): at com.google.android.material.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:131)
E/AndroidRuntime(18326): at com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(ThemeEnforcement.java:72)
E/AndroidRuntime(18326): at com.google.android.material.appbar.ViewUtilsLollipop.setStateListAnimatorFromAttrs(ViewUtilsLollipop.java:45)
E/AndroidRuntime(18326): at com.google.android.material.appbar.AppBarLayout.<init>(AppBarLayout.java:183)
E/AndroidRuntime(18326): ... 28 more
When googling for that particular error I find some things about ensuring that you create an AppCompat theme for your activity, etc. but since this is not my own activity that I'm trying to launch, I'm not really sure what to do here.

Related

How to use a bottom sheet dialog from navigation ui component

I'm using nav graph for internal navigations. Now I want to open a bottom sheet dialog fragment using nav_graph.
I tried adding
<dialog
android:id="#+id/ItemBottomSheetFragment"
android:name="xxxxxxx.fragments.InvoiceItemBottomSheetFragment"
tools:layout="#layout/fragment_invoice_item_bottom_sheet"
android:label="ItemBottomSheetFragment" />
But my app crashes when I launch it.
Crash report
2019-11-23 18:42:13.393 16111-16111/xxxxxxxxxxxxx E/AndroidRuntime: FATAL EXCEPTION: main
Process: xxxxxxxxxxxxx, PID: 16111
java.lang.RuntimeException: Unable to start activity ComponentInfo{xxxxxxxxxxxxx/xxxxxxxxxxxxx.MainActivity}: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class fragment
Caused by: java.lang.RuntimeException: Exception inflating xxxxxxxxxxxxx:navigation/nav_graph line 266
at androidx.navigation.NavInflater.inflate(NavInflater.java:90)
at androidx.navigation.NavController.setGraph(NavController.java:447)
at androidx.navigation.NavController.setGraph(NavController.java:429)
at androidx.navigation.fragment.NavHostFragment.onCreate(NavHostFragment.java:226)
at androidx.fragment.app.Fragment.performCreate(Fragment.java:2528)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:843)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1135)
at androidx.fragment.app.FragmentManagerImpl.addFragment(FragmentManagerImpl.java:1391)
at androidx.fragment.app.FragmentManagerImpl.onCreateView(FragmentManagerImpl.java:3123)
at androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:134)
at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:360)
at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:339)
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 androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:537)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:303)
at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284)
at xxxxxxxxxxxxx.MainActivity.onCreate(MainActivity.kt:19)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
2019-11-23 18:42:13.395 16111-16111/xxxxxxxxxxxxx E/AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.IllegalStateException: Could not find Navigator with name "dialog". You must call NavController.addNavigator() for each navigation type.
at androidx.navigation.NavigatorProvider.getNavigator(NavigatorProvider.java:98)
at androidx.navigation.NavInflater.inflate(NavInflater.java:100)
at androidx.navigation.NavInflater.inflate(NavInflater.java:132)
at androidx.navigation.NavInflater.inflate(NavInflater.java:81)
Previously I was using navigation UI version 2.0.0
After upgrading to 2.1.0, it's working fine

My app keep closing in the emulator after migrate to androidx. Does anyone have solution for this?

I just migrated to androidx. For some reason, my app keeps crashing whenever I use it in the emulator. I need help
I have been searching on the Internet for hours but have not seen any solution for that. I also examine my logcat but I do not get the error
2019-10-16 18:33:11.287 7763-7763/com.example.recyclerview E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.recyclerview, PID: 7763
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.recyclerview/com.example.recyclerview.MainActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class androidx.core.widget.DrawerLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class androidx.core.widget.DrawerLayout
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class androidx.core.widget.DrawerLayout
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.core.widget.DrawerLayout" on path: DexPathList[[zip file "/data/app/com.example.recyclerview-gS5TXhudi0GJX8tyIujcvA==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.recyclerview-gS5TXhudi0GJX8tyIujcvA==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.view.LayoutInflater.createView(LayoutInflater.java:606)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.recyclerview.MainActivity.onCreate(MainActivity.java:40)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
In the activity java and xml file with drawer layout replace androidx.core.widget.DrawerLayou with androidx.drawerlayout.widget.DrawerLayout. If you can't see it directly, use find option and search the string directly.
try to change androidx.core.widget.DrawerLayout with androidx.drawerlayout.widget.DrawerLayout
Your error message says your layout used in com.example.recyclerview.MainActivity.onCreate contains the class androidx.core.widget.DrawerLayout, but the package name for DrawerLayout is androidx.drawerlayout.widget.DrawerLayout. Correct your layout to use the right class name.

Arcore fragment crashes on startup

Just started with ARCore. I want to display a simple 3d model on a plane. I am using version 1.10.0 of ARCore. When I start up the app the app crashes with the stacktrace below:
This is my layout
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="#+id/ar_fragment"
android:name="com.google.ar.sceneform.ux.ArFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include
android:id="#+id/overlay"
layout="#layout/overlay"
app:showOverlay="#{showOverlay}" />
</FrameLayout>
I use databinding to inflate a layout. I have no Idea what I am doing wrong. It looks like the ArFragment can not be found.
2019-07-23 14:05:15.209 12108-12108/com.icapps.arcapps E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.icapps.arcapps, PID: 12108
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.icapps.arcapps/com.icapps.arcapps.activity.products.PlantDetailActivity}: android.view.InflateException: Binary XML file line #23: Binary XML file line #23: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3037)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3172)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1906)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.view.InflateException: Binary XML file line #23: Binary XML file line #23: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #23: Error inflating class fragment
Caused by: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.ar.sceneform.ux.ArFragment: calling Fragment constructor caused an exception
at androidx.fragment.app.Fragment.instantiate(Fragment.java:532)
at androidx.fragment.app.FragmentContainer.instantiate(FragmentContainer.java:57)
at androidx.fragment.app.FragmentManagerImpl$6.instantiate(FragmentManagerImpl.java:2850)
at androidx.fragment.app.FragmentManagerImpl.onCreateView(FragmentManagerImpl.java:3195)
at androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:134)
at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:357)
at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:336)
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 androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:545)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:303)
at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284)
at com.icapps.arcapps.activity.products.PlantDetailActivity.onCreate(PlantDetailActivity.kt:39)
at android.app.Activity.performCreate(Activity.java:7149)
at android.app.Activity.performCreate(Activity.java:7140)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1288)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3017)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3172)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1906)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
2019-07-23 14:05:15.210 12108-12108/com.icapps.arcapps E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at androidx.fragment.app.Fragment.instantiate(Fragment.java:514)
... 33 more
Caused by: java.lang.BootstrapMethodError: Exception from call site #38 bootstrap method
at com.google.ar.sceneform.ux.BaseArFragment.<init>(BaseArFragment.java:97)
at com.google.ar.sceneform.ux.ArFragment.<init>(ArFragment.java:35)
... 36 more
Caused by: java.lang.ClassCastException: Bootstrap method returned null
... 38 more
2019-07-23 14:05:15.211 12108-12108/com.icapps.arcapps E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.icapps.arcapps, PID: 12108
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.icapps.arcapps/com.icapps.arcapps.activity.products.PlantDetailActivity}: android.view.InflateException: Binary XML file line #23: Binary XML file line #23: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3037)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3172)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1906)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.view.InflateException: Binary XML file line #23: Binary XML file line #23: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #23: Error inflating class fragment
Caused by: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.ar.sceneform.ux.ArFragment: calling Fragment constructor caused an exception
at androidx.fragment.app.Fragment.instantiate(Fragment.java:532)
at androidx.fragment.app.FragmentContainer.instantiate(FragmentContainer.java:57)
at androidx.fragment.app.FragmentManagerImpl$6.instantiate(FragmentManagerImpl.java:2850)
at androidx.fragment.app.FragmentManagerImpl.onCreateView(FragmentManagerImpl.java:3195)
at androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:134)
at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:357)
at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:336)
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 androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:545)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:303)
at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284)
at com.icapps.arcapps.activity.products.PlantDetailActivity.onCreate(PlantDetailActivity.kt:39)
at android.app.Activity.performCreate(Activity.java:7149)
at android.app.Activity.performCreate(Activity.java:7140)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1288)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3017)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3172)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1906)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
2019-07-23 14:05:15.212 12108-12108/com.icapps.arcapps E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at androidx.fragment.app.Fragment.instantiate(Fragment.java:514)
... 33 more
Caused by: java.lang.BootstrapMethodError: Exception from call site #38 bootstrap method
at com.google.ar.sceneform.ux.BaseArFragment.<init>(BaseArFragment.java:97)
at com.google.ar.sceneform.ux.ArFragment.<init>(ArFragment.java:35)
... 36 more
Caused by: java.lang.ClassCastException: Bootstrap method returned null
... 38 more```
I forgot to add the compile options
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

Bottom Navigation mShiftedMode Not found

2019-05-30 14:37:58.684 24598-24598/com.tokr.com E/BNVHelper: Unable to get shift mode field
java.lang.NoSuchFieldException: No field mShiftingMode in class Landroid/support/design/internal/BottomNavigationMenuView; (declaration of 'android.support.design.internal.BottomNavigationMenuView' appears in /data/app/com.tokr.com-d7oEdvg1K1YZW81hAgZt5w==/base.apk!classes3.dex)
at java.lang.Class.getDeclaredField(Native Method)
at com.tokr.com.util.BottomNavigationViewHelper.disableShiftMode(BottomNavigationViewHelper.kt:12)
at com.tokr.com.ui.base.BaseActivity.handleBottomNav(BaseActivity.kt:272)
at com.tokr.com.ui.base.BaseActivity.onCreate(BaseActivity.kt:168)
at com.tokr.com.ui.base.BaseLocationActivity.onCreate(BaseLocationActivity.java:32)
at com.tokr.com.ui.home.HomeActivity.onCreate(HomeActivity.java:146)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3063)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:198)
at android.app.ActivityThread.main(ActivityThread.java:6729)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

New app which Use AndroidX artifacts crash

When creating new app and checking the Use Android X artifacts without modifying anything the app crash bout on my phone and the emulator.
I have asked my friend to repeat method of creating the app and every thing work in his phone.
It is my first time using Android X, Am I doing something wrong? I am running Android Studio 3.3.0.20 in snap (Linux).
2019-02-08 17:54:44.477 5487-5487/worshifter.com.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: worshifter.com.myapplication, PID: 5487
java.lang.RuntimeException: Unable to start activity ComponentInfo{worshifter.com.myapplication/worshifter.com.myapplication.MainActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class androidx.constraintlayout.widget.ConstraintLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class androidx.constraintlayout.widget.ConstraintLayout
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class androidx.constraintlayout.widget.ConstraintLayout
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
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.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at worshifter.com.myapplication.MainActivity.onCreate(MainActivity.java:12)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/constraintlayout/widget/R$styleable;
at androidx.constraintlayout.widget.ConstraintLayout.init(ConstraintLayout.java:590)
at androidx.constraintlayout.widget.ConstraintLayout.<init>(ConstraintLayout.java:567)
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:343) 
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.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at worshifter.com.myapplication.MainActivity.onCreate(MainActivity.java:12) 
at android.app.Activity.performCreate(Activity.java:7136) 
at android.app.Activity.performCreate(Activity.java:7127) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) 
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:6669) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
2019-02-08 17:54:44.478 5487-5487/worshifter.com.myapplication E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.constraintlayout.widget.R$styleable" on path: DexPathList[[zip file "/data/app/worshifter.com.myapplication-gnuqp7fLCQHjhJ5ZKGKRAQ==/base.apk"],nativeLibraryDirectories=[/data/app/worshifter.com.myapplication-gnuqp7fLCQHjhJ5ZKGKRAQ==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 28 more
Edit found out that when removing android.enableJetifier=true the app works.
I have the same issue.
As you see it show in logs: Error inflating class androidx.constraintlayout.widget.ConstraintLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
You should go to project level build.gradle and update ConstraintLayout to the latest version (and also the good idea update all other dependencies from beta versions):
Default dependencies:
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.core:core-ktx:1.1.0-alpha04'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
Actual version:
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
Also I created bugreport about this issue:
https://issuetracker.google.com/issues/122892917
The solution is as simple as upgrading the libraries to their latest version in the build.gradle file.
Hint: Use the Android Studio's linting feature to update the libraries to their latest version (Left Alt+Enter on Windows)
I got same error,
My release apk can install to Emulator, Device,
But it crashed.
I check build.gradle file, updated to library to latest version.
Also remove deprecated library, error library, as image in below.
Then, my release apk never got crash when start application as before.

Categories

Resources