Android Studio 2.1, Gradle 2.1.0
I've search similar problem here, but nothing found. Mostly related to, the emulator is good but not on real device.
The problem is, once the emulator is ready and the app is launched, the app suddenly crashed as I click on first activity. Then, I tried to run on real device and everything works as it should be.
1st. This issue is not the same as App running on emulator but not on
real device, it's backward with this one.
2nd. No errors in editor, just a little warning.
3rd. The logcats says; FATAL EXCEPTION: main.
What I've done;
1) Delete the current emulator only, without the system images.
2) Recreated the emulator, trying to launch the app, again, the app
crashed.
3) Delete, re-download all 3 system images;
ARM EABI v7a System Image.
Intel x86 Atom_64 System Image.
Intel x86 Atom System Image.
Crash Report;
FATAL EXCEPTION: main
Process: com.example.akmalzaki.uniklattendanceapp2, PID: 2942
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.akmalzaki.uniklattendanceapp2/com.example.akmalzaki.uniklattendanceapp2.Science}:
java.lang.NullPointerException: Attempt to invoke virtual method
'boolean android.nfc.NfcAdapter.isEnabled()' 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 'boolean android.nfc.NfcAdapter.isEnabled()' on a null object
reference
at
com.example.akmalzaki.uniklattendanceapp2.Science.onCreate(Science.java:49)
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)
You trying to get an NFC which emulator does not support. This may cause problems because there are still real devices in the world that dont have an NFC hardware. If it is critical to your application you should include manifest tag
<uses-feature android:name="android.hardware.nfc" android:required="true" />
This way the devices with no NFC support will not be able to install your application. If it is not critical, for example you have both NFC and QR Scan enabled, you can set this to false but you should very carefully check every method that asks NFCAdapter like this for example:
NfcAdapter.getDefaultAdapter(context) !=null
Related
I am trying to build libpjsua2.so using armeabi-v7a architecture type.
Here are the steps I followed:
https://trac.pjsip.org/repos/wiki/Getting-Started/Android
I just changed TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags and rest everything kept as it is.
It worked well with arm64-v8a and I am able to run project on Google Pixel.
When I build armeabi-v7a, I didn't receive any errors but when I run the project on Nexus 5, it gives me the following error:
08-09 16:52:01.625 19296-19296/com.pjdroid.sample E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.pjdroid.sample, PID: 19296
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__aeabi_memclr8" referenced by "/data/app/com.pjdroid.sample-1/lib/arm/libpjsua2.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:372)
at java.lang.System.loadLibrary(System.java:1076)
at com.pjdroid.sample.MyApp.(MyApp.java:278)
at com.pjdroid.sample.MainActivity.onCreate(MainActivity.java:114)
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 tried several times make clean and remove everything but every time I received this error.
I think there's some issue in creating this file for armeabi-v7a.
Can you suggest me if I am doing anything wrong in this?
Read the documentation. This is what the PJSIP getting started guide has to say (almost at the bottom)
UnsatisfiedLinkError exception with "cannot locate 'rand'" message.
As described here, this happens if you've built your native components with the android-21 target, but are trying to run it on a device with an older Android version, so re-run configure with APP_PLATFORM set to lower platform version, e.g:
APP_PLATFORM=android-19 ./configure-android
I released an update to an Android app yesterday, and today I am seeing a few crash logs in Crashlytics:
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapp/com.example.myapp.MyWebViewActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at com.example.myapp.MyWebViewActivity.onCreate(MyWebViewActivity.java:77)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
At the bottom this report mentions XposedBridge, which I find kind of odd. Is this caused by someone experimenting with my app using the Xposed framework? Or could this happen to a "normal user"? Crashlytics says the issue has affected 3 users so far, but I'm skeptical since they all have the exact same phone model and Android version (Motorola Nexus 6, Android 7.1.1) and happened within 10 minutes of each other.
The NPE is caused by getIntent().getStringExtra("some_string").equals("another_string") in an onCreate method, even though I am setting the "some_string" in all places where I'm creating this activity.
So what I'm wondering is if this sort of crash could be the result of anything other than a user who is experimenting with Xposed? I.e. should I take it seriously or not?
In general having the XposedBridge in the stack trace just means that the app runs on an device with XPosed installed. XPosed changes the Dalvik VM system wide, even if your app isn't modified by any XPosed module.
I don't have much experience with Crashlytics, however the "3 users" I would interpret as one user having cleared the app data two times.
Anyway I would always use safe coding, therefore your call
getIntent().getStringExtra("some_string").equals("another_string")
should be reformulated to:
"another_string".equals(getIntent().getStringExtra("some_string"))
This way is may be a bit unfamiliar to read, but it is safe against NullPointerException in case the current Intent does not has the "some_string" value.
I currently have an issue when I deploy my Titanium alloy application to the play store, when I launch it for the first time it crashes. This only happens in production.
When I reported the issue the following is what I found in the developer console:
java.lang.NullPointerException: Attempt to invoke virtual method
'android.content.res.Resources android.content.Context.getResources()'
on a null object reference at
android.view.ViewConfiguration.get(ViewConfiguration.java:359) at
android.view.View.(View.java:3663) at
android.view.View.(View.java:3758) at
android.widget.TextView.(TextView.java:650) at
android.widget.TextView.(TextView.java:645) at
android.widget.TextView.(TextView.java:641) at
android.widget.TextView.(TextView.java:637) at
ti.modules.titanium.ui.widget.TiUILabel$1.(TiUILabel.java:58)
at ti.modules.titanium.ui.widget.TiUILabel.(TiUILabel.java:57)
at ti.modules.titanium.ui.LabelProxy.createView(LabelProxy.java:63)
at
org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:490)
at
org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:476)
at
org.appcelerator.titanium.proxy.TiViewProxy.handleToImage(TiViewProxy.java:965)
at
org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:280)
at android.os.Handler.dispatchMessage(Handler.java:98) at
android.os.Looper.loop(Looper.java:211) at
android.app.ActivityThread.main(ActivityThread.java:5373) at
java.lang.reflect.Method.invoke(Native Method) at
java.lang.reflect.Method.invoke(Method.java:372) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)
Since I don't know where excalty it went wrong since it is in production I don't know what code to supply. I understand it is a null reference error, but nowhere in my application I use a getResources() function, or something like that.
The second time I run it it just works
Titanium Version: 6.0.1.GA
Mac OS X: 10.12.3
Target android SDK: 23
Android version: 5.1
Any help would be appriciated!
I have an application that compiles and runs fine when run on a machine X.
We check the code out compile and run it on machine Y and it generates a null pointer exception.
The Null pointer exception is listed below the main body.
I have investigated and the code is failing when a findViewById() call is executed on an edit text box.
The call has an id (integer) but returns a null in the place of the view.
We have tried cleaning and rebuilding the project but this does not seem to resolve the problem.
I believe the problem may some how be related to R.java identifiers being corrupted on the new install.
09-08 15:50:10.186 28278-28278/ca.client.crmlogon E/ACRA: ACRA caught a RuntimeException for ca.client.crmlogon
java.lang.RuntimeException: Unable to start activity ComponentInfo{ca.client.crmlogon/ca.client.crmlogon.Activities.WorkOrderActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setVisibility(int)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2790)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2855)
at android.app.ActivityThread.access$900(ActivityThread.java:181)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1474)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6117)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setVisibility(int)' on a null object reference
at ca.client.crmlogon.Activities.GUIFormActivity.hideFieldById(GUIFormActivity.java:690)
at ca.client.crmlogon.Activities.GUIFormActivity.hideFieldByName(GUIFormActivity.java:697)
at ca.client.crmlogon.Activities.WorkOrderActivity.hideAgreementSection(WorkOrderActivity.java:1604)
at ca.client.crmlogon.Activities.WorkOrderActivity.loadServiceAppointment(WorkOrderActivity.java:2026)
at ca.client.crmlogon.Activities.WorkOrderActivity.onCreate(WorkOrderActivity.java:515)
at android.app.Activity.performCreate(Activity.java:6374)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2743)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2855)�
at android.app.ActivityThread.access$900(ActivityThread.java:181)�
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1474)�
at android.os.Handler.dispatchMessage(Handler.java:102)�
at android.os.Looper.loop(Looper.java:145)�
at android.app.ActivityThread.main(ActivityThread.java:6117)�
at java.lang.reflect.Method.invoke(Native Method)�
at java.lang.reflect.Method.invoke(Method.java:372)�
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)�
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
You may be missing some files. If you transfered it using Git, make sure all your files were added before your last commit/push.
If you transfered it over a USB stick, etc. you may have accidentally removed the device before the transfer was complete.
My first suggestion is to try the transfer again, making sure you didn't miss any files.
I have an app that was written a couple years back that I am in the process of maintaining. The app uses HoloEverywhere and ActionBarSherlock to provide certain functionality back to older versions of the OS. Until recently there have never been any problems with this, so it was quite a shock to see support complaints about the app crashing on startup this week. These crashes are all on Android 6.0 devices and all come with the following exception message.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.laridian.pocketbible/com.laridian.pocketbible.PocketBibleMainActivity}: java.lang.RuntimeException: java.lang.IllegalAccessException: java.lang.Class<org.holoeverywhere.addon.AddonSherlock$HoloActionBarSherlockNative> is not accessible from java.lang.Class<com.actionbarsherlock.ActionBarSherlock>
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.RuntimeException: java.lang.IllegalAccessException: java.lang.Class<org.holoeverywhere.addon.AddonSherlock$HoloActionBarSherlockNative> is not accessible from java.lang.Class<com.actionbarsherlock.ActionBarSherlock>
at com.actionbarsherlock.ActionBarSherlock.wrap(ActionBarSherlock.java:238)
at org.holoeverywhere.addon.AddonSherlock$AddonSherlockA.getSherlock(AddonSherlock.java:54)
at org.holoeverywhere.addon.AddonSherlock$AddonSherlockA.requestWindowFeature(AddonSherlock.java:159)
at org.holoeverywhere.app.Activity$24.action(Activity.java:515)
at org.holoeverywhere.app.Activity$24.action(Activity.java:1)
at org.holoeverywhere.addon.IAddonBasicAttacher.performAddonAction(IAddonBasicAttacher.java:122)
at org.holoeverywhere.app.Activity.performAddonAction(Activity.java:505)
at org.holoeverywhere.app.Activity.requestWindowFeature(Activity.java:512)
at android.support.v4.app._HoloActivity.onInit(_HoloActivity.java:491)
at android.support.v4.app._HoloActivity.forceInit(_HoloActivity.java:227)
at org.holoeverywhere.app.Activity.onCreate(Activity.java:225)
at com.laridian.pocketbible.PocketBibleActivity.onCreate(PocketBibleActivity.java:126)
at com.laridian.pocketbible.PocketBibleMainActivity.onCreate(PocketBibleMainActivity.java:1180)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
... 9 more
Caused by: java.lang.IllegalAccessException: java.lang.Class<org.holoeverywhere.addon.AddonSherlock$HoloActionBarSherlockNative> is not accessible from java.lang.Class<com.actionbarsherlock.ActionBarSherlock>
at java.lang.reflect.Constructor.newInstance(Native Method)
at com.actionbarsherlock.ActionBarSherlock.wrap(ActionBarSherlock.java:230)
... 24 more
So I know something has changed with regard to these libraries. However, I'm not sure what I can do about this. Is there a new version of ActionBarSherlock that is compatible with Android 6.0? Is there a version of HoloEverywhere that will work for Android 6.0? Is there something I'm missing here? Or am I going to have to go back and rewrite my whole app to support Android 6.0?
You are working with an old version of a deprecated library. HoloEverywhere stopped to use ABS like 2 years ago. ABS was deprecated long time ago too. No one support to those libraries right now.
My tip: remove your HoloEverywhere dependencie. Then embrace Material and/or move your minSdk to 15.
If you can't do that: update to the last version of HoloEverywhere. This is the faster fix, but you are working with a deprecated library...