I am following this guide and based on here, it says
Don't bother using older versions of Android. Use the highest SDK
target available. Phonegap will take care of backwards compatibility
for you.
So I use these targets:
Build target
Android 2.3.3
and
minimum SDK 4
and use
cordova-1.9.0.jar
but gives following error when I try to run it on Android 1.6
E/dalvikvm(200): Could not find method android.webkit.WebView.<init>, referenced from method org.apache.cordova.CordovaWebView.<init>
W/dalvikvm(200): VFY: unable to resolve direct method 285: Landroid/webkit/WebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
W/dalvikvm(200): VFY: rejecting opcode 0x70 at 0x0001
W/dalvikvm(200): VFY: rejected Lorg/apache/cordova/CordovaWebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
W/dalvikvm(200): Verifier rejected class Lorg/apache/cordova/CordovaWebView;
D/AndroidRuntime(200): Shutting down VM
W/dalvikvm(200): threadid=3: thread exiting with uncaught exception (group=0x4001aa28)
E/AndroidRuntime(200): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime(200): java.lang.VerifyError: org.apache.cordova.CordovaWebView
E/AndroidRuntime(200): at org.apache.cordova.DroidGap.init(DroidGap.java:297)
E/AndroidRuntime(200): at org.apache.cordova.DroidGap.loadUrl(DroidGap.java:343)
E/AndroidRuntime(200): at phone.gap.test.PhonegapTestActivity.onCreate(PhonegapTestActivity.java:13)
E/AndroidRuntime(200): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
E/AndroidRuntime(200): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
E/AndroidRuntime(200): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
E/AndroidRuntime(200): at android.app.ActivityThread.access$2100(ActivityThread.java:116)
E/AndroidRuntime(200): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
E/AndroidRuntime(200): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(200): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(200): at android.app.ActivityThread.main(ActivityThread.java:4203)
E/AndroidRuntime(200): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(200): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(200): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
E/AndroidRuntime(200): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
E/AndroidRuntime(200): at dalvik.system.NativeStart.main(Native Method)
However it runs well when I run it on Android 2.3.3.
Does Phonegap not support Android 1.6?
PhoneGap 1.0 removed support for Android releases before 2.1. You could use one of the 0.9.x releases with Android 1.6.
Since you are using PhoneGap 1.9, have a look at this: http://docs.phonegap.com/en/1.9.0/guide_cordova-webview_android.md.html#Embedding%20Cordova%20WebView%20on%20Android
While it would be ideal to support back to 1.6, you're only giving up <1% of your potential market reach if you move up to 2.1. Previous answers on this topic have also suggested using 2.1 (minSdkLevel="7") as your bottom end.
Related
I'm trying to run hello world app using Rho Studio (just New -> Project -> Finish) on various supported platforms. I managed to run it on win32. I'm curious about windows mobile deployment, but I'm holding out now, since it requires paid subscription. The app also runs on all platforms on simulator, however I failed to run it on android using either run configuration -> Android -> Device) and RhoMobile -> Production Build -> Android, Local.
I've installed Android SDK, and NDK. I run keytool.exe manually since cert generation requires keyboard input and it blocked rake script. Generally builds are ok, and I have RhoMobileApplication1-debug.apk or RhoMobileApplication1-signed.apk.
Then I deploy it to the device
adb install *.apk
And when I run the app it almost immediately crashes with standard android messagebox when something goes really wrong. So i did adb logcat to file and figure out that possibly cause is that when loading librhodes.so it tries to load soinfo_relocate and fail.
However at this point my superpowers failed me, because google gives me only clue that it might be something with the Android NDK itself.
Any suggestions?
D/AbsListView(29935): unregisterIRListener() is called
E/dalvikvm( 6074): dlopen("/data/app-lib/com.rhomobile.rhomobileapplication1-1/librhodes.so") failed: Cannot load library: soinfo_relocate(linker.cpp:976): cannot locate symbol "sigemptyset" referenced by "librhodes.so"...
W/dalvikvm( 6074): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/rhomobile/rhodes/RhodesApplication;
W/dalvikvm( 6074): Class init failed in newInstance call (Lcom/rhomobile/rhodes/RhodesApplication;)
D/AndroidRuntime( 6074): Shutting down VM
W/dalvikvm( 6074): threadid=1: thread exiting with uncaught exception (group=0x42040930)
E/AndroidRuntime( 6074): FATAL EXCEPTION: main
E/AndroidRuntime( 6074): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 6074): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 6074): at java.lang.Class.newInstance(Class.java:1319)
E/AndroidRuntime( 6074): at android.app.Instrumentation.newApplication(Instrumentation.java:1000)
E/AndroidRuntime( 6074): at android.app.Instrumentation.newApplication(Instrumentation.java:985)
E/AndroidRuntime( 6074): at android.app.LoadedApk.makeApplication(LoadedApk.java:499)
E/AndroidRuntime( 6074): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4565)
E/AndroidRuntime( 6074): at android.app.ActivityThread.access$1400(ActivityThread.java:157)
E/AndroidRuntime( 6074): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
E/AndroidRuntime( 6074): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 6074): at android.os.Looper.loop(Looper.java:176)
E/AndroidRuntime( 6074): at android.app.ActivityThread.main(ActivityThread.java:5319)
E/AndroidRuntime( 6074): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 6074): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 6074): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
E/AndroidRuntime( 6074): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
E/AndroidRuntime( 6074): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 6074): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_relocate(linker.cpp:976): cannot locate symbol "sigemptyset" referenced by "librhodes.so"...
E/AndroidRuntime( 6074): at java.lang.Runtime.loadLibrary(Runtime.java:371)
E/AndroidRuntime( 6074): at java.lang.System.loadLibrary(System.java:535)
E/AndroidRuntime( 6074): at com.rhomobile.rhodes.NativeLibraries.load(NativeLibraries.java:5)
E/AndroidRuntime( 6074): at com.rhomobile.rhodes.RhodesApplication.(RhodesApplication.java:105)
E/AndroidRuntime( 6074): ... 16 more
D/SensorService( 1959): -0.1 0.7 10.0
D/CrashAnrDetector( 1959): processName: com.rhomobile.rhomobileapplication1
D/CrashAnrDetector( 1959): broadcastEvent : com.rhomobile.rhomobileapplication1 data_app_crash
RhoMobileSuite5.2.2
jre1.8.0_51
android-ndk-r10e
phone with android 4.2.2
tablet with android 4.4.2
RhoMobile doesn't support at this moment NDK r10, you need to use NDK r9, as documented on RhoMobile documentation website.
On RhoMobile developer forums there're some discussion about other issues linked to people using NDK r10:
Rhostudio 5.1.1 not work in kitkat and lower versions
Android NDK r10d, Lollipop, 64-bit
I have developed an android application. This application runs perfectly in my device but crashes in emulator.
Since in my college we have to present the application in emulator, this error is creating a lot of problem.
Logcat
03-30 10:52:52.633: E/AndroidRuntime(257): Uncaught handler: thread main exiting due to uncaught exception
03-30 10:52:52.653: E/AndroidRuntime(257): java.lang.NoSuchMethodError: com.example.festipedia_logo.main.getActionBar
03-30 10:52:52.653: E/AndroidRuntime(257): at com.example.festipedia_logo.main.onCreate(main.java:51)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.os.Handler.dispatchMessage(Handler.java:99)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.os.Looper.loop(Looper.java:123)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.app.ActivityThread.main(ActivityThread.java:4363)
03-30 10:52:52.653: E/AndroidRuntime(257): at java.lang.reflect.Method.invokeNative(Native Method)
03-30 10:52:52.653: E/AndroidRuntime(257): at java.lang.reflect.Method.invoke(Method.java:521)
03-30 10:52:52.653: E/AndroidRuntime(257): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-30 10:52:52.653: E/AndroidRuntime(257): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-30 10:52:52.653: E/AndroidRuntime(257): at dalvik.system.NativeStart.main(Native Method)
03-30 10:52:52.693: E/dalvikvm(257): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
It is because your emaluator is not supporting action bar. Try either of these
1 - use action bar sherlock instead of action bar. Google it for its implementation.
2 - try increasing the android version of emaluator to ICS or more.
I recommend using action bar sherlock
From official documentation, try following it and see if the error is gone.
The ActionBar APIs were first added in Android 3.0 (API level 11) but
they are also available in the Support Library for compatibility with
Android 2.1 (API level 7) and above.
This guide focuses on how to use the support library's action bar, but
if your app supports only Android 3.0 or higher, you should use the
ActionBar APIs in the framework. Most of the APIs are the same—but
reside in a different package namespace—with a few exceptions to
method names or signatures that are noted in the sections below.
Caution: Be certain you import the ActionBar class (and related APIs)
from the appropriate package:
If supporting API levels lower than 11:
import android.support.v7.app.ActionBar
If supporting only API level 11 and higher:
import android.app.ActionBar
More At: http://developer.android.com/guide/topics/ui/actionbar.html
You can also check http://actionbarsherlock.com/
Just tell your emulator to support the same API level as your device and the problem should magically vanish. It's a configuration setting in the emulator.
as I have read a java.lang.VerifyError in many cases hints to referencing
incompatible jar files which do not rely on the Android SDK.
My question is, whether there is a way to check,
which method calls in particular within the imported jar files are incompatible.
Is it possible to list the conflicts?
Like this I would like to check whether it is a lot of effort to make my ready made
java programme android compatible or not?
So far I only get an VerifyError and which file causes it.
But since it is a file referencing other stuff and having some code, I would like to know at which locations exactly there is the error.
EDIT:
Here you can see the log of the LogCat.
09-21 11:10:03.080: W/dalvikvm(1988): VFY: unable to resolve exception class 427 (L/codec/ContentAccessException;)
09-21 11:10:03.080: W/dalvikvm(1988): VFY: unable to find exception handler at addr 0x16
09-21 11:10:03.080: W/dalvikvm(1988): VFY: rejected Lsmb/LPP_SM;.start ()[Ljava/lang/String;
09-21 11:10:03.080: W/dalvikvm(1988): VFY: rejecting opcode 0x0d at 0x0016
09-21 11:10:03.080: W/dalvikvm(1988): VFY: rejected Lsmb/LPP_SM;.start ()[Ljava/lang/String;
09-21 11:10:03.080: W/dalvikvm(1988): Verifier rejected class Lsmb/LPP_SM;
09-21 11:10:03.080: D/AndroidRuntime(1988): Shutting down VM
09-21 11:10:03.080: W/dalvikvm(1988): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
09-21 11:10:03.110: E/AndroidRuntime(1988): FATAL EXCEPTION: main
09-21 11:10:03.110: E/AndroidRuntime(1988): java.lang.VerifyError: smb/LPP_SM
09-21 11:10:03.110: E/AndroidRuntime(1988): at com.example.androidtest.DisplayMessageActivity.onCreate(DisplayMessageActivity.java:109)
09-21 11:10:03.110: E/AndroidRuntime(1988): at android.app.Activity.performCreate(Activity.java:5008)
09-21 11:10:03.110: E/AndroidRuntime(1988): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
09-21 11:10:03.110: E/AndroidRuntime(1988): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
09-21 11:10:03.110: E/AndroidRuntime(1988): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
09-21 11:10:03.110: E/AndroidRuntime(1988): at android.app.ActivityThread.access$600(ActivityThread.java:130)
09-21 11:10:03.110: E/AndroidRuntime(1988): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-21 11:10:03.110: E/AndroidRuntime(1988): at android.os.Handler.dispatchMessage(Handler.java:99)
09-21 11:10:03.110: E/AndroidRuntime(1988): at android.os.Looper.loop(Looper.java:137)
09-21 11:10:03.110: E/AndroidRuntime(1988): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-21 11:10:03.110: E/AndroidRuntime(1988): at java.lang.reflect.Method.invokeNative(Native Method)
09-21 11:10:03.110: E/AndroidRuntime(1988): at java.lang.reflect.Method.invoke(Method.java:511)
09-21 11:10:03.110: E/AndroidRuntime(1988): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-21 11:10:03.110: E/AndroidRuntime(1988): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-21 11:10:03.110: E/AndroidRuntime(1988): at dalvik.system.NativeStart.main(Native Method)
I have asked for a list of the problematic classes or function calls.
Here I believe I can only see, that the ContentAccessException is the only issue
not compatible with Android.
At least, if I comment that part within e.g. LPP_SM the error would vanish.
But this Exception is from one of my used libraries, which I cannot change.
Could there be more conflicts?
You should be able to track the problem by carefully reading the output of "adb logcat". You should be able to see the class that could not be found as well as the class that has the bad reference. Search for WARN/dalvikvm just before the exception.
There are a few more information on this thread : Android java.lang.VerifyError?
Are you in Debug mode or using proguard for a release ? the java.lang.VerifyError is due to a different compilator version, if you have any external jars that uses android class (like View) and your target sdk is different from the used one to generate the jar. You will find the class in the Log with error. Can you provide the complete error? If your are using proguard you can prevent preverification using -dontpreverify -dontoptimizeoption.
I developed the project in Eclipse, then moved to IntelliJ IDEA CE 12, then moved back to the Eclipse. IDEA had converted it to eclipse project not correctly, so I imported project from existing source and added line
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
to the section. Ok, it compiles successfully, but generates a lot of strange errors for the classes written by me and then crashes.
LogCat output:
E/dalvikvm( 9673): Could not find class 'com.capsule.launcher.views.Screen', referenced from method com.capsule.launcher.views.Workspace$1.onPageSelected
W/dalvikvm( 9673): VFY: unable to resolve check-cast 458 (Lcom/capsule/launcher/views/Screen;) in Lcom/capsule/launcher/views/Workspace$1;
D/dalvikvm( 9673): VFY: replacing opcode 0x1f at 0x0010
W/dalvikvm( 9673): Unable to resolve superclass of Lcom/capsule/launcher/views/CellLayout; (346)
W/dalvikvm( 9673): Link of class 'Lcom/capsule/launcher/views/CellLayout;' failed
W/dalvikvm( 9673): Unable to resolve superclass of Lcom/capsule/launcher/views/DockBar; (455)
W/dalvikvm( 9673): Link of class 'Lcom/capsule/launcher/views/DockBar;' failed
W/dalvikvm( 9673): VFY: unable to find class referenced in signature (Lcom/capsule/launcher/views/DockBar;)
W/dalvikvm( 9673): Unable to resolve superclass of Lcom/capsule/launcher/views/CellLayout; (346)
W/dalvikvm( 9673): Link of class 'Lcom/capsule/launcher/views/CellLayout;' failed
W/dalvikvm( 9673): Unable to resolve superclass of Lcom/capsule/launcher/views/DockBar; (455)
W/dalvikvm( 9673): Link of class 'Lcom/capsule/launcher/views/DockBar;' failed
E/dalvikvm( 9673): Could not find class 'com.capsule.launcher.views.DockBar', referenced from method com.capsule.launcher.views.WorkspaceHolder.onLayout
W/dalvikvm( 9673): VFY: unable to resolve instanceof 456 (Lcom/capsule/launcher/views/DockBar;) in Lcom/capsule/launcher/views/WorkspaceHolder;
D/dalvikvm( 9673): VFY: replacing opcode 0x20 at 0x001b
D/AndroidRuntime( 9673): Shutting down VM
W/dalvikvm( 9673): threadid=1: thread exiting with uncaught exception (group=0x40d6e300)
E/AndroidRuntime( 9673): FATAL EXCEPTION: main
E/AndroidRuntime( 9673): java.lang.NoClassDefFoundError: com.capsule.launcher.views.DockBar
E/AndroidRuntime( 9673): at com.capsule.launcher.LauncherActivity.createWorkspace(LauncherActivity.java:116)
E/AndroidRuntime( 9673): at com.capsule.launcher.LauncherActivity.onCreate(LauncherActivity.java:58)
E/AndroidRuntime( 9673): at android.app.Activity.performCreate(Activity.java:5008)
E/AndroidRuntime( 9673): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
E/AndroidRuntime( 9673): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
E/AndroidRuntime( 9673): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
E/AndroidRuntime( 9673): at android.app.ActivityThread.access$600(ActivityThread.java:130)
E/AndroidRuntime( 9673): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
E/AndroidRuntime( 9673): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 9673): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 9673): at android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime( 9673): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 9673): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 9673): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 9673): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 9673): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 301): Force finishing activity com.capsule.launcher/.LauncherActivity
D/dalvikvm( 9673): GC_CONCURRENT freed 4207K, 20% free 19381K/23943K, paused 13ms+4ms, total 52ms
W/ActivityManager( 301): Activity pause timeout for ActivityRecord{418f0cd0 com.capsule.launcher/.LauncherActivity}
D/dalvikvm( 301): GC_CONCURRENT freed 1886K, 28% free 22076K/30279K, paused 4ms+9ms, total 99ms
W/ActivityManager( 301): Activity destroy timeout for ActivityRecord{418f0cd0 com.capsule.launcher/.LauncherActivity}
D/Finsky ( 7843): [1] 5.onFinished: Installation state replication succeeded.
It worked fine in IDEA and Eclipse before!
I don't know what happend to your project, but try in Eclipse: Project--> Clean--> YourProject
Clean and Build Your Project in Eclipse.Also check in Android Manifest file ,if launcher Activity is defined correctly with its package name.
Its not a good idea to use it like this(manually) rather we can export projects from IntelliJ IDEA to Eclipse in simple steps.
please follow this standard document for the above.
http://www.jetbrains.com/idea/webhelp/exporting-intellij-idea-project-to-eclipse.html
hope this will help you.
if you use librarys in your project , try in build path add to the library export
If you do have the old working eclipse project then copy/replace all the new code and jars to it, from the IntelliJ IDEA project. Remember to copy/replace only the code and jars not the IntelliJ IDEA specific settings files.
Right click on the project which has issues and select properties.
Select the appropriate Android build (1.1, 1.5 or 1.5 with google api) and say ok.
Again right click on the project and select "Android Tools > Fix Project Properties"
Fix the imports once (if required)
Refresh the project and you should be ready to go without any manual editing
Hope this helps.
Two days ago, when my android project in eclipse still worked, I added "android SDK 4.0.3" to my SDKs (in addition to android SDK 2.1).
From that moment on, I have a trouble with slf4j-android library; here's the exception:
Uncaught handler: thread main exiting due to uncaught exception
java.lang.ExceptionInInitializerError
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1479)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.access$2200(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
at it.cefriel.swa.urbanopoly.client.game.UrbanopolyActivity.<clinit>(UrbanopolyActivity.java:11)
The JAR I use is slf4j-android-1.5.8.jar. The build path seems correctly setted. I also tried to create another project using slf4j and I got the same error..
Any Ideas?
Thanks in advance
Try adding the slf4j-api-1.5.8.jar or latest version as well with the current slf4j-android-1.5.8.jar