Does anyone know what this means? I'm trying to start a transaction in onActivityResult() to insert a row based on the received result.
03-05 15:39:51.937:
ERROR/Database(2387): Failure 21 (out
of memory) on 0x0 when preparing
'BEGIN EXCLUSIVE;'.
03-05 15:39:51.967:
DEBUG/AndroidRuntime(2387): Shutting
down VM 03-05 15:39:51.967:
WARN/dalvikvm(2387): threadid=3:
thread exiting with uncaught exception
(group=0x40013140)
03-05 15:39:51.967:
ERROR/AndroidRuntime(2387): Uncaught
handler: thread main exiting due to
uncaught exception
03-05 15:39:52.137:
ERROR/AndroidRuntime(2387):
java.lang.RuntimeException: Failure
delivering result ResultInfo{who=null,
request=1, result=-1, data=Intent {
(has extras) }} to activity
{com.ozdroid/com.ozdroid.load.LoadView}:
android.database.sqlite.SQLiteException:
unknown error: BEGIN EXCLUSIVE;
...
03-05 15:39:52.137:
ERROR/AndroidRuntime(2387): Caused by:
android.database.sqlite.SQLiteException:
unknown error: BEGIN EXCLUSIVE;
...
03-05 15:39:52.137:
ERROR/AndroidRuntime(2387): at
android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:434)
I've had this happen to me in two situations:
when SQL statements contain syntax errors
when beginTransaction is called on a not-open database connection
It looks like you've run into number two. Check your syntax and make sure you open() (and don't close()) your database before you call beginTransaction.
And I think we can agree that the resulting logcat error messages are not 100% helpful.
Related
My application is doing quite a bit of initialization in the Application::onCreate() method, and I have a check that will throw an exception if it is called twice.
However, in some specific circumstance, the Application::onCreate() gets called twice. I added the following Log statement in onCreate(): (instance is a static variable)
Log.i(TAG, "Application::ctor, this=" + this + " instance=" + instance + " pid="
+ android.os.Process.myPid());
I got two logs (normally, instance == null):
09-20 19:14:42.151 {main} [INFO] [Application] Application::ctor, this=com.shawnma.MyApplication#428886b0 instance=null pid=10741
09-20 19:14:50.116 {main} [INFO] [Application] Application::ctor, this=com.shawnma.MyApplication#42923e00 instance=com.shawnma.MyApplication#428886b0 pid=10741
In this case, I returned from the onCreate() method - it won't hurt since everything should always be in memory. However, another exception shows immediately after that from Android system:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.innopath.mobilemd/com.innopath.mobilemd.ui.LauncherActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.view.ContextThemeWrapper.initializeTheme(ContextThemeWrapper.java:100)
at android.view.ContextThemeWrapper.setTheme(ContextThemeWrapper.java:51)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2019)
... 11 more
It seems the second Application creation is triggered by an ALARM_MANAGER wake up. But still, the first creation of the app should have been done and saved in a memory location?
Check if there is another process specified in your AndroidManifest. If you app contains two processes that use the same Application, the the onCreate method in Application will be invoked twice.
I've been reading a lot and searching on the internet and I have found similar questions but still no answer. So I will try again :)
I'm developing an app with phonegap 2.7 and I'm using the recommended function to upload pictures. The problem is that some users are reporting an exception when trying to select their pictures, and the app is crashing.
Looking at the google play console I can see this error:
java.lang.RuntimeException: Unable to resume activity
{com.xmile.events/com.xmile.events.MainActivity}: java.lang.RuntimeException: Failure
delivering result ResultInfo{who=null, request=18, result=-1, data=Intent {
dat=content://media/external/images/media/201233 }} to activity
{com.xmile.events/com.xmile.events.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2444)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2472)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1986)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null,
request=18, result=-1, data=Intent { dat=content://media/external/images/media/201233 }}
to activity {com.xmile.events/com.xmile.events.MainActivity}:
java.lang.NullPointerException
at android.app.ActivityThread.deliverResults(ActivityThread.java:2980)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2431)
... 12 more
Caused by: java.lang.NullPointerException
at org.apache.cordova.DroidGap.onActivityResult(DroidGap.java:858)
at android.app.Activity.dispatchActivityResult(Activity.java:4649)
at android.app.ActivityThread.deliverResults(ActivityThread.java:2976)
... 13 more
The function to select the image is this one:
function selectPicture() {
pictureSource=navigator.camera.PictureSourceType;
destinationType=navigator.camera.DestinationType;
// Retrieve image file location from specified source
navigator.camera.getPicture(
onPhotoURISuccess, onFail, { quality: 25,
destinationType: destinationType.FILE_URI,
sourceType: pictureSource.PHOTOLIBRARY });
}
So I understand the problem arises when a user selects an image and goes back to the main process... somehow it is dead and then a NPE comes up :'( Even more weird, it only happens to a few users and I can't reproduce it with my mobile.
Any help would be highly appreciated!
I guess you are trying with Android version 4.1 or 4.2. If it's the case so refer to this answer :
Phonegap : Upload picture crashes on Samsung mobile 4.1.2 but works fine on Google Nexus 4.3.0
I'm trying to make in-app purchase flow work in my app. I use helper classes from http://developer.android.com/training/in-app-billing/preparing-iab-app.html (IabHelper etc.). Everything's fine until I make payment. When returning to activity, this exception is raised
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null,
request=10001, result=-1, data=Intent { (has extras) }} to activity
{com.sunlight.mangomonitor/com.sunlight.mangomonitor.PurchaseActivity}:
java.lang.IllegalArgumentException: java.security.spec.InvalidKeySpecException:
java.lang.RuntimeException: error:0D07209B:asn1 encoding routines:ASN1_get_object:too long
at android.app.ActivityThread.deliverResults(ActivityThread.java:3408)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3451)
at android.app.ActivityThread.access$1200(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1332)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5296)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: java.security.spec.InvalidKeySpecException:
java.lang.RuntimeException: error:0D07209B:asn1 encoding routines:ASN1_get_object:too long
at com.sunlight.mangomonitor.util.Security.generatePublicKey(Security.java:92)
at com.sunlight.mangomonitor.util.Security.verifyPurchase(Security.java:66)
at com.sunlight.mangomonitor.util.IabHelper.handleActivityResult(IabHelper.java:460)
at com.sunlight.mangomonitor.PurchaseActivity.onActivityResult(PurchaseActivity.java:145)
at android.app.Activity.dispatchActivityResult(Activity.java:5444)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3404)
... 11 more
Caused by: java.security.spec.InvalidKeySpecException: java.lang.RuntimeException:
error:0D07209B:asn1 encoding routines:ASN1_get_object:too long
at
org.apache.harmony.xnet.provider.jsse.OpenSSLRSAKeyFactory.engineGeneratePublic(OpenSSLRSAKeyF actory.java:52)
at java.security.KeyFactory.generatePublic(KeyFactory.java:171)
at com.sunlight.mangomonitor.util.Security.generatePublicKey(Security.java:87)
... 16 more
Caused by: java.lang.RuntimeException: error:0D07209B:asn1 encoding
routines:ASN1_get_object:too long
at org.apache.harmony.xnet.provider.jsse.NativeCrypto.d2i_PUBKEY(Native Method)
at org.apache.harmony.xnet.provider.jsse.OpenSSLRSAKeyFactory.engineGeneratePublic(OpenSSLRSAKeyfactory.java:48)
I found that activity that started the purchase may be destroyed, what should I do in that case?
Any suggestions?
call that purchase activity using calling activity for result concept.check whether the result at onActivityResult() function using RESULT_OK and RESULT_CANCELLED so you find out.
We are testing greendao for concurrency issues when there are two different threads within the same process trying to persist at the same time.
We spawn two threads in the same process and are having them insert 100, randomly populated, dao's at the same time.
GreenDao version 1.3.0
Please let me know if we are doing something wrong or if you need more information, thanks!
We keep getting this error:
04-04 14:29:48.528: E/Database(17736): Failure 5 (database is locked) on 0x2d4c98 when executing 'BEGIN EXCLUSIVE;'
04-04 14:29:48.528: W/dalvikvm(17736): threadid=10: thread exiting with uncaught exception (group=0x40018560)
04-04 14:29:48.538: E/AndroidRuntime(17736): FATAL EXCEPTION: Thread-11
04-04 14:29:48.538: E/AndroidRuntime(17736): android.database.sqlite.SQLiteException: database is locked: BEGIN EXCLUSIVE;
04-04 14:29:48.538: E/AndroidRuntime(17736): at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
04-04 14:29:48.538: E/AndroidRuntime(17736): at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1772)
04-04 14:29:48.538: E/AndroidRuntime(17736): at android.database.sqlite.SQLiteDatabase.beginTransactionWithListener(SQLiteDatabase.java:536)
04-04 14:29:48.538: E/AndroidRuntime(17736): at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:490)
04-04 14:29:48.538: E/AndroidRuntime(17736): at de.greenrobot.dao.AbstractDao.executeInsert(AbstractDao.java:344)
04-04 14:29:48.538: E/AndroidRuntime(17736): at de.greenrobot.dao.AbstractDao.insert(AbstractDao.java:293)
Here is my code that is used for inserting a dao:
getGreenDaoSession().getMyDao().insert(this.myDao);
Finally figured this out.
Each thread was spawning a separate DaoSession. Each thread, since they are in the same process, needs to be using the same DaoSession.
This does concern me though, i am wondering how this will work when we attempt to do this same test but having the threads on different processes.
how to add username and password in http request to call web service? I have write REST web service and if user want to do request ,he neeed to request like this in terminal :
curl -u username:password http://localhost:8080/user/folder
httpclient.getCredentialsProvider().setCredentials(new AuthScope(null, -1),
new UsernamePasswordCredentials("kyaw", "password"));
get.setHeader("Authorization","Basic a31hdzpwYXNzd29yZA==");
I used either way to do in android but get exception :
05-20 07:13:30.900: DEBUG/AndroidRuntime(557): Shutting down VM
05-20 07:13:30.900: WARN/dalvikvm(557): threadid=1: thread exiting with uncaught exception (group=0x40015560)
05-20 07:13:30.972: ERROR/AndroidRuntime(557): FATAL EXCEPTION: main
05-20 07:13:30.972: ERROR/AndroidRuntime(557): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test/com.test.put}: java.lang.RuntimeException: Binary XML file line #18: You must supply a layout_width attribute.
05-20 07:13:30.972: ERROR/AndroidRuntime(557): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
05-20 07:13:30.972: ERROR/AndroidRuntime(557): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
How do i do?
The error is "You must supply a layout_width attribute" (copy pasted from your stack trace).
The error is unrelated to the code you are showing. You are missing a layout_width="" attribute in one of your components XML declaration.