I have created an app in which I've used android.support.v4.widget.DrawerLayout along with android.support.v7.widget.Toolbar.
When I run this app on a Samsung Tablet Neo (Android version 4.2.2), the app is running perfectly.
But when I run the same app on Google Nexus 5 (Android version 6.0.1), I'm getting ResourceNotFoundException and the app just crashes on the starting line of the following code in my Java (Activity) file.
The app crashes on this line: setSupportActionBar(topToolBar);
FATAL EXCEPTION: main
rocess: com.myapp, PID: 11761
va.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp/com.myapp.MainActivityWithNavigationViewExpandableList}: android.content.res.Resources$NotFoundException: File res/color/abc_hint_foreground_material_dark.xml from color state list resource ID #0x7f0c00ab
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
aused by: android.content.res.Resources$NotFoundException: File res/color/abc_hint_foreground_material_dark.xml from color state list resource ID #0x7f0c00ab
at android.content.res.Resources.loadColorStateListForCookie(Resources.java:2750)
at android.content.res.Resources.loadColorStateList(Resources.java:2699)
at android.content.res.TypedArray.getColorStateList(TypedArray.java:485)
at android.widget.TextView.<init>(TextView.java:746)
at android.widget.TextView.<init>(TextView.java:671)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:62)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:58)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:54)
at android.support.v7.widget.Toolbar.setTitle(Toolbar.java:756)
at android.support.v7.widget.ToolbarWidgetWrapper.setTitleInt(ToolbarWidgetWrapper.java:261)
at android.support.v7.widget.ToolbarWidgetWrapper.setWindowTitle(ToolbarWidgetWrapper.java:243)
at android.support.v7.app.ToolbarActionBar.<init>(ToolbarActionBar.java:78)
at android.support.v7.app.AppCompatDelegateImplV9.setSupportActionBar(AppCompatDelegateImplV9.java:223)
at android.support.v7.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:130)
at com.myapp.MainActivityWithNavigationViewExpandableList.onCreate(MainActivityWithNavigationViewExpandableList.java:64)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
aused by: java.lang.NumberFormatException: Invalid float: "0.70000005dip"
at java.lang.StringToReal.invalidReal(StringToReal.java:63)
at java.lang.StringToReal.initialParse(StringToReal.java:164)
at java.lang.StringToReal.parseFloat(StringToReal.java:323)
at java.lang.Float.parseFloat(Float.java:306)
at android.content.res.TypedArray.getFloat(TypedArray.java:396)
at android.content.res.ColorStateList.inflate(ColorStateList.java:275)
at android.content.res.ColorStateList.createFromXmlInner(ColorStateList.java:222)
at android.content.res.ColorStateList.createFromXml(ColorStateList.java:201)
at android.content.res.Resources.loadColorStateListForCookie(Resources.java:2746)
at android.content.res.Resources.loadColorStateList(Resources.java:2699)
at android.content.res.TypedArray.getColorStateList(TypedArray.java:485)
at android.widget.TextView.<init>(TextView.java:746)
at android.widget.TextView.<init>(TextView.java:671)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:62)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:58)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:54)
at android.support.v7.widget.Toolbar.setTitle(Toolbar.java:756)
at android.support.v7.widget.ToolbarWidgetWrapper.setTitleInt(ToolbarWidgetWrapper.java:261)
at android.support.v7.widget.ToolbarWidgetWrapper.setWindowTitle(ToolbarWidgetWrapper.java:243)
at android.support.v7.app.ToolbarActionBar.<init>(ToolbarActionBar.java:78)
at android.support.v7.app.AppCompatDelegateImplV9.setSupportActionBar(AppCompatDelegateImplV9.java:223)
at android.support.v7.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:130)
at com.myapp.MainActivityWithNavigationViewExpandableList.onCreate(MainActivityWithNavigationViewExpandableList.java:64)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
I searched other SO answers as well.
The resource 'abc_hint_foreground_material_dark' is not in my 'color'. This resource should come from Support Library of Android, which I'm using in Android Studio.
abc_hint_foreground_material_dark is a link to the theme's foreground_material_dark, see here.
The NumberFormatException says that this color value is invalid ('Invalid float: "0.70000005dip"'). This value does not come from support library so must have been set by your resources (check colors.xml and values.xml). Color values should be hex integers and are not in dp or any other unit. See here for more info.
So finally I digged more in the issue and my suspect was NumberFormatException. I searched for decimal values in my dimens.xml file and commented them. And it worked fine now. Basically, Android was unable to parse the decimal values placed in dimens.xml file.
Related
I am trying to change the icon on a button inside a ListView at runtime, but when my code has calls to getDrawable, e.g.
getDrawable(android.R.drawable.ic_media_pause)
I get java.lang.NoClassDefFoundError from inside the activity's onCreate method. When I remove calls to getDrawable, the app runs fine.
01-29 18:31:43.526 30890-30890/com.p403n1x87.motee E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.p403n1x87.motee, PID: 30890
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/p403n1x87/motee/device/DeviceActivity$onCreate$adapter$1$1;
at com.p403n1x87.motee.device.DeviceActivity.onCreate(DeviceActivity.kt:40)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.p403n1x87.motee.device.DeviceActivity$onCreate$adapter$1$1" on path: DexPathList[[zip file "/data/app/com.p403n1x87.motee-1/base.apk"],nativeLibraryDirectories=[/data/app/com.p403n1x87.motee-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.p403n1x87.motee.device.DeviceActivity.onCreate(DeviceActivity.kt:40)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Suppressed: java.lang.ClassNotFoundException: com.p403n1x87.motee.device.DeviceActivity$onCreate$adapter$1$1
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 14 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
After seeing the same error when trying to get the intent from the activity inside an anonymous class instance, I realised that I should have explicitly requested the method from it, i.e. it.getDrawable. Given that the build process completes successfully, this looks like a Kotlin bug to me.
Can't load a layout, activity fails on: setContentView
the "missing" resource is the activity layout itself found under layout folder
Activity extends FragmentActivity
the device: HTC M9 running marshmallow
stack trace:
Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{MyActivty}:
android.content.res.Resources$NotFoundException: File Share with %s from xml type layout resource ID #0x7f0a001d
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2484)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
at android.app.ActivityThread.access$900(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:168)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
Caused by: android.content.res.Resources$NotFoundException: File Share with %s from xml type layout resource ID #0x7f0a001d
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2836)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2791)
at android.content.res.Resources.getLayout(Resources.java:1173)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:411)
at android.app.Activity.setContentView(Activity.java:2177)
at packageName.MyActivty.onCreate(MyActivty.java:43)
at android.app.Activity.performCreate(Activity.java:6248)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
at android.app.ActivityThread.access$900(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:168)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
Caused by: java.io.FileNotFoundException: Share with %s
at android.content.res.AssetManager.openXmlAssetNative(Native Method)
at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:508)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2818)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2791)
at android.content.res.Resources.getLayout(Resources.java:1173)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:411)
at android.app.Activity.setContentView(Activity.java:2177)
at packageName.MyActivity.onCreate(MyActivty.java:43)
at android.app.Activity.performCreate(Activity.java:6248)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
at android.app.ActivityThread.access$900(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:168)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
12-24 17:43:16.037 10054-10054/com.deepinstinct.android.dev.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.deepinstinct.android.dev.debug, PID: 10054
java.lang.RuntimeException: Unable to start activity ComponentInfo{packageName/packageName.MyActivity}:
android.content.res.Resources$NotFoundException: File Share with %s from xml type layout resource ID #0x7f0a001d
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2484)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
at android.app.ActivityThread.access$900(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:168)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
Caused by: android.content.res.Resources$NotFoundException: File Share with %s from xml type layout resource ID #0x7f0a001d
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2836)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2791)
at android.content.res.Resources.getLayout(Resources.java:1173)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:411)
at android.app.Activity.setContentView(Activity.java:2177)
at packageName.MyActivity.onCreate(MyActivity.java:43)
at android.app.Activity.performCreate(Activity.java:6248)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
at android.app.ActivityThread.access$900(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:168)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
Caused by: java.io.FileNotFoundException: Share with %s
at android.content.res.AssetManager.openXmlAssetNative(Native Method)
at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:508)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2818)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2791)
at android.content.res.Resources.getLayout(Resources.java:1173)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:411)
at android.app.Activity.setContentView(Activity.java:2177)
at packageName.MyActivity.onCreate(MyActivity.java:43)
at android.app.Activity.performCreate(Activity.java:6248)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
at android.app.ActivityThread.access$900(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:168)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
I have never seen this error: File Share with %s from xml type layout resource
how can i fix this?
solved it:
I had an android library loaded to my project by reflection. the specified resource in the stack trace: 0x7f0a001d (my layout id) was a resource id of an appcompat component in the loaded library and the resources conflicted.
brute force solution:
create a unique layout id for my layout that doesn't conflict with the loaded library's one (by copy-pasting the original layout). obviously not the best solution
actual solution that worked for me:
the loaded library is all code and there is no native android functionality, so I have removed the appcompat v7 support library from the .gradle, making the conflicting resource to disappear
Learning Cognito using the Android sample. As far as I can tell I have followed the example on the read me page here except for one thing... There is a section that I do not understand:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="YOUR_REDIRECT_URI_AUTHORITY"android:scheme="YOUR_REDIRECT_SCHEME"/>
</intent-filter>
What is the line:
android:host="YOUR_REDIRECT_URI_AUTHORITY"android:scheme="YOUR_REDIRECT_SCHEME"
The error I am getting in Android Studio is:
11-23 21:48:52.860
12915-12915/com.amazonaws.cognito.android.samples.authdemo
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.amazonaws.cognito.android.samples.authdemo, PID: 12915
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.amazonaws.cognito.android.samples.authdemo/com.amazonaws.cognito.android.samples.authdemo.MainActivity}:
com.amazonaws.mobileconnectors.cognitoauth.exceptions.AuthInvalidParameterException:
validation failed
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by:
com.amazonaws.mobileconnectors.cognitoauth.exceptions.AuthInvalidParameterException:
validation failed
at
com.amazonaws.mobileconnectors.cognitoauth.Auth$Builder.validateCognitoAuthParameters(Auth.java:341)
at
com.amazonaws.mobileconnectors.cognitoauth.Auth$Builder.build(Auth.java:288)
at
com.amazonaws.cognito.android.samples.authdemo.MainActivity.initCognito(MainActivity.java:121)
at
com.amazonaws.cognito.android.samples.authdemo.MainActivity.onCreate(MainActivity.java:48)
at android.app.Activity.performCreate(Activity.java:6237)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by:
com.amazonaws.mobileconnectors.cognitoauth.exceptions.AuthInvalidParameterException:
{"AppCognitoWebDomain":"invalid"}
at
com.amazonaws.mobileconnectors.cognitoauth.Auth$Builder.validateCognitoAuthParameters(Auth.java:338)
at
com.amazonaws.mobileconnectors.cognitoauth.Auth$Builder.build(Auth.java:288)
at
com.amazonaws.cognito.android.samples.authdemo.MainActivity.initCognito(MainActivity.java:121)
at
com.amazonaws.cognito.android.samples.authdemo.MainActivity.onCreate(MainActivity.java:48)
at android.app.Activity.performCreate(Activity.java:6237)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
The host & scheme in intent filter data specify the Cognito app client's redirect URI. For details about data, see this. As for what do you configure in your app, see this example. So, if you use this example as your data then you would need to set your redirect_uri in Cognito Userpool console as demoapp://www.loginactivity.com/mainactivity. As for webdomain, you need to setup your Userpool domain in strings.xml.
I used this library https://github.com/liuguangqiang/IPicker
This is my code:
public void onClick(View view) {
switch (view.getId()) {
case R.id.ll_profile_pic_container:
IPicker.open(getApplicationContext(), selectPictures);
return;
...
}
This is the error I receive when in activity com.liuguangqiang.ipicker.IPickerActivity I select my image from the gallery:
java.lang.RuntimeException: Unable to start activity ComponentInfo{rp.com.bmicalculator/com.liuguangqiang.ipicker.crop.CropImageActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setHomeAsUpIndicator(int)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setHomeAsUpIndicator(int)' on a null object reference
at com.liuguangqiang.ipicker.crop.CropImageActivity.initToolbar(CropImageActivity.java:116)
at com.liuguangqiang.ipicker.crop.CropImageActivity.onCreate(CropImageActivity.java:91)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
I've followed all the directions I've provided from the library author ... Can the bug be in the library? No, because I've tested the app created by the same author and everything works perfectly ...
So, I installed the library you mentioned. Everything seems to work well. Maybe you are using AppTheme with no ActionBar?
I am trying to integrate Google Sign-In on my Android application and website.
I integrated them separately, and while integrating it on website, I received a server client id through which I integrated the backend of it as well.
Now when integrating it in Android using Firebase and downloading the Google configuration Gson from console and passing the same server side client id in GoogleSignInoptions.requestIDToken, it crashes the app saying there are two server side id clients provided.
I am not really sure how to correct this. My error:
Process: com.example.ayush.bottomnavigation, PID: 23326
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ayush.bottomnavigation/com.example.ayush.bottomnavigation.SignInActivity}: java.lang.IllegalArgumentException: two different server client ids provided
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.IllegalArgumentException: two different server client ids provided
at com.google.android.gms.common.internal.zzab.zzb(Unknown Source)
at com.google.android.gms.auth.api.signin.GoogleSignInOptions$Builder.zzfs(Unknown Source)
at com.google.android.gms.auth.api.signin.GoogleSignInOptions$Builder.requestIdToken(Unknown Source)
at com.example.ayush.bottomnavigation.SignInActivity.onCreate(SignInActivity.java:64)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)