I am using eclipse indigo with android ADT 20 but everytime it shows error that application stop unexpectedly.
Please any one have idea about how to use both of them with each other?
I also refer some google groupe which shows to update ecllipse and I also follow that but still not working. Thx in advance...
LOGS:
07-27 16:48:04.958: D/ddm-heap(217): Got feature list request
07-27 16:48:05.328: I/dalvikvm(217): Could not find method android.webkit.WebView.<init>, referenced from method org.apache.cordova.CordovaWebView.<init>
07-27 16:48:05.328: W/dalvikvm(217): VFY: unable to resolve direct method 3114: Landroid/webkit/WebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
07-27 16:48:05.328: D/dalvikvm(217): VFY: replacing opcode 0x70 at 0x0001
07-27 16:48:05.328: D/dalvikvm(217): Making a copy of Lorg/apache/cordova/CordovaWebView;.<init> code (196 bytes)
07-27 16:48:05.658: D/dalvikvm(217): GC freed 807 objects / 63672 bytes in 104ms
07-27 16:48:05.948: E/dalvikvm(217): Could not find class 'android.webkit.WebResourceResponse', referenced from method org.apache.cordova.CordovaWebViewClient.generateWebResourceResponse
07-27 16:48:05.958: W/dalvikvm(217): VFY: unable to resolve new-instance 451 (Landroid/webkit/WebResourceResponse;) in Lorg/apache/cordova/CordovaWebViewClient;
07-27 16:48:05.958: D/dalvikvm(217): VFY: replacing opcode 0x22 at 0x0046
07-27 16:48:05.958: D/dalvikvm(217): Making a copy of Lorg/apache/cordova/CordovaWebViewClient;.generateWebResourceResponse code (245 bytes)
07-27 16:48:05.958: W/dalvikvm(217): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
07-27 16:48:05.998: W/dalvikvm(217): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
07-27 16:48:06.014: W/dalvikvm(217): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
07-27 16:48:06.014: I/dalvikvm(217): Could not find method android.webkit.WebViewClient.shouldInterceptRequest, referenced from method org.apache.cordova.CordovaWebViewClient.shouldInterceptRequest
07-27 16:48:06.014: W/dalvikvm(217): VFY: unable to resolve virtual method 3125: Landroid/webkit/WebViewClient;.shouldInterceptRequest (Landroid/webkit/WebView;Ljava/lang/String;)Landroid/webkit/WebResourceResponse;
07-27 16:48:06.014: D/dalvikvm(217): VFY: replacing opcode 0x6f at 0x0015
07-27 16:48:06.014: D/dalvikvm(217): Making a copy of Lorg/apache/cordova/CordovaWebViewClient;.shouldInterceptRequest code (68 bytes)
07-27 16:48:06.018: W/dalvikvm(217): VFY: unable to find class referenced in signature (Landroid/webkit/ConsoleMessage;)
07-27 16:48:06.018: I/dalvikvm(217): Could not find method android.webkit.ConsoleMessage.message, referenced from method org.apache.cordova.CordovaChromeClient.onConsoleMessage
07-27 16:48:06.018: W/dalvikvm(217): VFY: unable to resolve virtual method 3084: Landroid/webkit/ConsoleMessage;.message ()Ljava/lang/String;
07-27 16:48:06.018: D/dalvikvm(217): VFY: replacing opcode 0x6e at 0x0000
07-27 16:48:06.028: D/dalvikvm(217): Making a copy of Lorg/apache/cordova/CordovaChromeClient;.onConsoleMessage code (56 bytes)
07-27 16:48:06.038: W/System.err(217): =====================================================================================
07-27 16:48:06.056: W/System.err(217): ERROR: plugin.xml is missing. Add res/xml/plugins.xml to your project.
07-27 16:48:06.056: W/System.err(217): https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/res/xml/plugins.xml
07-27 16:48:06.056: W/System.err(217): =====================================================================================
07-27 16:48:06.056: W/ResourceType(217): No package identifier when getting name for resource number 0x00000000
07-27 16:48:06.058: D/AndroidRuntime(217): Shutting down VM
07-27 16:48:06.058: W/dalvikvm(217): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
07-27 16:48:06.058: E/AndroidRuntime(217): Uncaught handler: thread main exiting due to uncaught exception
07-27 16:48:06.078: E/AndroidRuntime(217): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.testdemo/com.example.testdemo.MainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0
07-27 16:48:06.078: E/AndroidRuntime(217): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
07-27 16:48:06.078: E/AndroidRuntime(217): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
07-27 16:48:06.078: E/AndroidRuntime(217): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
07-27 16:48:06.078: E/AndroidRuntime(217): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
07-27 16:48:06.078: E/AndroidRuntime(217): at android.os.Handler.dispatchMessage(Handler.java:99)
07-27 16:48:06.078: E/AndroidRuntime(217): at android.os.Looper.loop(Looper.java:123)
07-27 16:48:06.078: E/AndroidRuntime(217): at android.app.ActivityThread.main(ActivityThread.java:4363)
07-27 16:48:06.078: E/AndroidRuntime(217): at java.lang.reflect.Method.invokeNative(Native Method)
07-27 16:48:06.078: E/AndroidRuntime(217): at java.lang.reflect.Method.invoke(Method.java:521)
07-27 16:48:06.078: E/AndroidRuntime(217): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
07-27 16:48:06.078: E/AndroidRuntime(217): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
07-27 16:48:06.078: E/AndroidRuntime(217): at dalvik.system.NativeStart.main(Native Method)
07-27 16:48:06.078: E/AndroidRuntime(217): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
07-27 16:48:06.078: E/AndroidRuntime(217): at android.content.res.Resources.getValue(Resources.java:891)
07-27 16:48:06.078: E/AndroidRuntime(217): at android.content.res.Resources.loadXmlResourceParser(Resources.java:1865)
07-27 16:48:06.078: E/AndroidRuntime(217): at android.content.res.Resources.getXml(Resources.java:779)
07-27 16:48:06.078: E/AndroidRuntime(217): at org.apache.cordova.api.PluginManager.loadPlugins(PluginManager.java:99)
07-27 16:48:06.078: E/AndroidRuntime(217): at org.apache.cordova.api.PluginManager.init(PluginManager.java:76)
07-27 16:48:06.078: E/AndroidRuntime(217): at org.apache.cordova.CordovaWebView.loadUrlIntoView(CordovaWebView.java:361)
07-27 16:48:06.078: E/AndroidRuntime(217): at org.apache.cordova.CordovaWebView.loadUrl(CordovaWebView.java:314)
07-27 16:48:06.078: E/AndroidRuntime(217): at org.apache.cordova.DroidGap.loadUrl(DroidGap.java:356)
07-27 16:48:06.078: E/AndroidRuntime(217): at com.example.testdemo.MainActivity.onCreate(MainActivity.java:12)
07-27 16:48:06.078: E/AndroidRuntime(217): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-27 16:48:06.078: E/AndroidRuntime(217): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
07-27 16:48:06.078: E/AndroidRuntime(217): ... 11 more
07-27 16:48:06.098: I/dalvikvm(217): threadid=7: reacting to signal 3
07-27 16:48:06.098: E/dalvikvm(217): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
07-27 16:48:08.998: I/Process(217): Sending signal. PID: 217 SIG: 9
This issue occurs because the "lib" folder is renamed to "libs" now by Android People.
You need to create a libs folder instead of lib and then place your cordova.jar file there.
And as soon as we place our external jars to this "libs" folder then it will automatically be added to the build path of the application. Then run your application....
Let me know if this helps you...
You should try debugging your build. See here: http://www.droidnova.com/debugging-in-android-using-eclipse,541.html
I would recommend downloading the android sdk examples (ie native code examples) and running them to understand how android works. This will help you in setting up phonegap (which is just a webview in an android app with a JS-Native bridge).
To get the android sdk examples you can download them through the android "sdk manager"
Related
I am trying to move some frameworks from classes.dex to classes2.dex (MultiDex) from an existing APK. To do so I use smali. It seem it works for some apps and for some not:
D/dalvikvm( 1401): GC_CONCURRENT freed 258K, 24% free 13896K/18268K, paused 2ms+1ms, total 19ms
I/dalvikvm( 2737): Could not find method com.facebook.FacebookSdk.sdkInitialize, referenced from method com.foursquare.robin.App.onCreate
W/dalvikvm( 2737): VFY: unable to resolve static method 16788: Lcom/facebook/FacebookSdk;.sdkInitialize (Landroid/content/Context;)V
D/dalvikvm( 2737): VFY: replacing opcode 0x71 at 0x014d
E/dalvikvm( 2737): Could not find class 'com.twitter.sdk.android.core.u', referenced from method com.foursquare.common.app.support.am.a
W/dalvikvm( 2737): VFY: unable to resolve new-instance 8004 (Lcom/twitter/sdk/android/core/u;) in Lcom/foursquare/common/app/support/am;
D/dalvikvm( 2737): VFY: replacing opcode 0x22 at 0x0005
D/dalvikvm( 2737): DexOpt: unable to opt direct call 0xd553 at 0x09 in Lcom/foursquare/common/app/support/am;.a
I/MultiDex( 2737): VM with version 1.6.0 does not have multidex support
I/MultiDex( 2737): install
I/MultiDex( 2737): MultiDexExtractor.load(/data/app/com.foursquare.robin-1.apk, false)
I/MultiDex( 2737): Detected that extraction must be performed.
D/dalvikvm( 2737): GC_CONCURRENT freed 325K, 11% free 3389K/3784K, paused 1ms+0ms, total 5ms
I/MultiDex( 2737): Extraction is needed for file /data/data/com.foursquare.robin/code_cache/secondary-dexes/com.foursquare.robin-1.apk.classes2.zip
I/MultiDex( 2737): Extracting /data/data/com.foursquare.robin/code_cache/secondary-dexes/com.foursquare.robin-1.apk.classes-838392451.zip
I/MultiDex( 2737): Renaming to /data/data/com.foursquare.robin/code_cache/secondary-dexes/com.foursquare.robin-1.apk.classes2.zip
I/MultiDex( 2737): Extraction success - length /data/data/com.foursquare.robin/code_cache/secondary-dexes/com.foursquare.robin-1.apk.classes2.zip: 392940
I/MultiDex( 2737): load found 1 secondary dex files
D/dalvikvm( 2737): DexOpt: --- BEGIN 'com.foursquare.robin-1.apk.classes2.zip' (bootstrap=0) ---
I/dalvikvm( 2753): No library specified. The standard exception handler will be used
D/dalvikvm( 2753): DexOpt: load 18ms, verify+opt 57ms, 1428508 bytes
D/dalvikvm( 2737): DexOpt: --- END 'com.foursquare.robin-1.apk.classes2.zip' (success) ---
D/dalvikvm( 2737): DEX prep '/data/data/com.foursquare.robin/code_cache/secondary-dexes/com.foursquare.robin-1.apk.classes2.zip': unzip in 13ms, rewrite 232ms
I/MultiDex( 2737): install done
D/AndroidRuntime( 2737): Shutting down VM
W/dalvikvm( 2737): threadid=1: thread exiting with uncaught exception (group=0x42d5d140)
E/AndroidRuntime( 2737): FATAL EXCEPTION: main
E/AndroidRuntime( 2737): Process: com.foursquare.robin, PID: 2737
E/AndroidRuntime( 2737): java.lang.NoClassDefFoundError: com.twitter.sdk.android.core.u
E/AndroidRuntime( 2737): at com.foursquare.common.app.support.am.a(SourceFile)
E/AndroidRuntime( 2737): at com.foursquare.robin.App.onCreate(SourceFile:213)
E/AndroidRuntime( 2737): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
E/AndroidRuntime( 2737): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
E/AndroidRuntime( 2737): at android.app.ActivityThread.access$1500(ActivityThread.java:135)
E/AndroidRuntime( 2737): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
E/AndroidRuntime( 2737): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 2737): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 2737): at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime( 2737): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2737): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 2737): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime( 2737): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime( 2737): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 1321): Force finishing activity com.foursquare.robin/.activities.MainActivity
Is this because MultiDex is installed after Twitter API or do I have to modify something else than the dex files?
I'll first quote myself (from this blogpost):
So what is main dex, and which classes it must include?
On application start, the default ClassLoader has a single entry in
its path - classes.dex file. It is also called the main dex. To
support more than one dex file, the multidex support library
implemented runtime patching of ClassLoader's path. This code should
run as soon as you have the application context (the perfect place for
it is in Application#attachBaseContext method).
Therefore, the Application class should be definitely included in the
main dex, since it should already be present when you patching the
ClassLoader.
Any other classes must be included? Yes. There's a thing called
Dalvik verifier that has complex rules for determining
inappropriate bytecode. For example, before loading the Application
class, VM verifier performs its checks and if it finds a field whose
type it can't resolve (yet), it will not allow to run instruction that
accessing this field, even if at that point of time we already patched
the ClassLoader and the class could be resolved.
In your example, app's Application class (com.foursquare.robin.App) indirectly depends on com.twitter.sdk.android.core.u class. But as you can see in your logs, Dalvik verifier already patched the new-instance instruction:
E/dalvikvm( 2737): Could not find class 'com.twitter.sdk.android.core.u', referenced from method com.foursquare.common.app.support.am.a
W/dalvikvm( 2737): VFY: unable to resolve new-instance 8004 (Lcom/twitter/sdk/android/core/u;) in Lcom/foursquare/common/app/support/am;
D/dalvikvm( 2737): VFY: replacing opcode 0x22 at 0x0005
I keep getting java.lang.NoClassDefFoundError: android.support.v7.app.ActionBarActivityDelegate error for the last two days and I am going to hate android, it it keeps going like this. I am really hopeless. I am adding goseamless api and I get this error just after the
superOnCreate method on this line of code
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
it gives the error below while it is trying to set contentView
. But if I dont add it , the app builds without a problem.
This is the stack trace
07-27 15:10:18.130 814-814/com.fourspan.ekmobi I/System.out﹕ debugger has settled (1365)
07-27 15:10:18.180 814-814/com.fourspan.ekmobi V/HwPolicyFactory﹕ : success to get AllImpl object and return....
07-27 15:10:18.210 814-814/com.fourspan.ekmobi V/HwWidgetFactory﹕ : successes to get AllImpl object and return....
07-27 15:10:19.450 814-814/com.fourspan.ekmobi D/dalvikvm﹕ threadid=1: still suspended after undo (sc=1 dc=1)
07-27 15:10:31.590 814-814/com.fourspan.ekmobi E/dalvikvm﹕ Could not find class 'android.support.v7.app.ActionBarActivityDelegateJBMR2', referenced from method android.support.v7.app.ActionBarActivityDelegate.createDelegate
07-27 15:10:31.590 814-814/com.fourspan.ekmobi W/dalvikvm﹕ VFY: unable to resolve new-instance 1269 (Landroid/support/v7/app/ActionBarActivityDelegateJBMR2;) in Landroid/support/v7/app/ActionBarActivityDelegate;
07-27 15:10:31.590 814-814/com.fourspan.ekmobi D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0006
07-27 15:10:31.590 814-814/com.fourspan.ekmobi E/dalvikvm﹕ Could not find class 'android.support.v7.app.ActionBarActivityDelegateJB', referenced from method android.support.v7.app.ActionBarActivityDelegate.createDelegate
07-27 15:10:31.590 814-814/com.fourspan.ekmobi W/dalvikvm﹕ VFY: unable to resolve new-instance 1268 (Landroid/support/v7/app/ActionBarActivityDelegateJB;) in Landroid/support/v7/app/ActionBarActivityDelegate;
07-27 15:10:31.590 814-814/com.fourspan.ekmobi D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0012
07-27 15:10:31.600 814-814/com.fourspan.ekmobi E/dalvikvm﹕ Could not find class 'android.support.v7.app.ActionBarActivityDelegateICS', referenced from method android.support.v7.app.ActionBarActivityDelegate.createDelegate
07-27 15:10:31.600 814-814/com.fourspan.ekmobi W/dalvikvm﹕ VFY: unable to resolve new-instance 1267 (Landroid/support/v7/app/ActionBarActivityDelegateICS;) in Landroid/support/v7/app/ActionBarActivityDelegate;
07-27 15:10:31.600 814-814/com.fourspan.ekmobi D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x001e
07-27 15:10:31.600 814-814/com.fourspan.ekmobi E/dalvikvm﹕ Could not find class 'android.support.v7.app.ActionBarActivityDelegateHC', referenced from method android.support.v7.app.ActionBarActivityDelegate.createDelegate
07-27 15:10:31.600 814-814/com.fourspan.ekmobi W/dalvikvm﹕ VFY: unable to resolve new-instance 1266 (Landroid/support/v7/app/ActionBarActivityDelegateHC;) in Landroid/support/v7/app/ActionBarActivityDelegate;
07-27 15:10:31.600 814-814/com.fourspan.ekmobi D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x002a
07-27 15:10:31.600 814-814/com.fourspan.ekmobi E/dalvikvm﹕ Could not find class 'android.support.v7.app.ActionBarActivityDelegateBase', referenced from method android.support.v7.app.ActionBarActivityDelegate.createDelegate
07-27 15:10:31.600 814-814/com.fourspan.ekmobi W/dalvikvm﹕ VFY: unable to resolve new-instance 1265 (Landroid/support/v7/app/ActionBarActivityDelegateBase;) in Landroid/support/v7/app/ActionBarActivityDelegate;
07-27 15:10:31.600 814-814/com.fourspan.ekmobi D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0030
07-27 15:10:31.600 814-814/com.fourspan.ekmobi E/dalvikvm﹕ Could not find class 'android.support.v7.app.ActionBarActivityDelegate$ActionBarDrawableToggleImpl', referenced from method android.support.v7.app.ActionBarActivityDelegate.getDrawerToggleDelegate
07-27 15:10:31.600 814-814/com.fourspan.ekmobi W/dalvikvm﹕ VFY: unable to resolve new-instance 1263 (Landroid/support/v7/app/ActionBarActivityDelegate$ActionBarDrawableToggleImpl;) in Landroid/support/v7/app/ActionBarActivityDelegate;
07-27 15:10:31.600 814-814/com.fourspan.ekmobi D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0000
07-27 15:10:31.610 814-814/com.fourspan.ekmobi W/dalvikvm﹕ VFY: unable to resolve static field 2683 (ActionBarWindow) in Landroid/support/v7/appcompat/R$styleable;
07-27 15:10:31.610 814-814/com.fourspan.ekmobi D/dalvikvm﹕ VFY: replacing opcode 0x62 at 0x0004
07-27 15:10:31.610 814-814/com.fourspan.ekmobi D/dalvikvm﹕ DexOpt: unable to opt direct call 0x2523 at 0x08 in Landroid/support/v7/app/ActionBarActivityDelegate;.createDelegate
07-27 15:10:31.610 814-814/com.fourspan.ekmobi D/dalvikvm﹕ DexOpt: unable to opt direct call 0x2522 at 0x14 in Landroid/support/v7/app/ActionBarActivityDelegate;.createDelegate
07-27 15:10:31.610 814-814/com.fourspan.ekmobi D/dalvikvm﹕ DexOpt: unable to opt direct call 0x2521 at 0x20 in Landroid/support/v7/app/ActionBarActivityDelegate;.createDelegate
07-27 15:10:31.610 814-814/com.fourspan.ekmobi D/dalvikvm﹕ DexOpt: unable to opt direct call 0x2520 at 0x2c in Landroid/support/v7/app/ActionBarActivityDelegate;.createDelegate
07-27 15:10:31.620 814-814/com.fourspan.ekmobi D/dalvikvm﹕ DexOpt: unable to opt direct call 0x251f at 0x32 in Landroid/support/v7/app/ActionBarActivityDelegate;.createDelegate
07-27 15:10:31.620 814-814/com.fourspan.ekmobi D/dalvikvm﹕ DexOpt: unable to opt direct call 0x24fe at 0x03 in Landroid/support/v7/app/ActionBarActivityDelegate;.getDrawerToggleDelegate
07-27 15:10:31.620 814-814/com.fourspan.ekmobi D/AndroidRuntime﹕ Shutting down VM
07-27 15:10:31.620 814-814/com.fourspan.ekmobi W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41f58c50)
07-27 15:10:31.630 814-814/com.fourspan.ekmobi E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.fourspan.ekmobi, PID: 814
java.lang.NoClassDefFoundError: android.support.v7.app.ActionBarActivityDelegateJBMR2
at android.support.v7.app.ActionBarActivityDelegate.createDelegate(ActionBarActivityDelegate.java:48)
at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:96)
at com.fourspan.ekmobi.SplashScreenActivity.onCreate(SplashScreenActivity.java:18)
at android.app.Activity.performCreate(Activity.java:5286)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2319)
at android.app.ActivityThread.access$1100(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1232)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5253)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:939)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
at dalvik.system.NativeStart.main(Native Method)
07-27 15:12:46.750 814-814/com.fourspan.ekmobi I/Process﹕ Sending signal. PID: 814 SIG: 9
Also here is my buildGraddle for app
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion 22.0.1
defaultConfig {
minSdkVersion 16
targetSdkVersion 21
multiDexEnabled true
}
dexOptions {
//incremental true
javaMaxHeapSize "2048M"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
repositories {
maven {
url "http://maven.seamlessapi.com:8081/nexus/content/repositories/releases/"
}
}
dependencies {
compile files('libs/picasso-2.5.2.jar')
compile project(':Libraries:CropImageLib')
compile project(':Libraries:facebook-android')
compile project(':Libraries:NineOldLibs')
compile project(':Libraries:SlidingMenu')
compile files('libs/JTransforms-3.0.jar')
compile files('libs/JLargeArrays-1.2.jar')
compile files('libs/gdata-core-1.0.jar')
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:support-v4:18.0.+'
compile 'com.android.support:appcompat-v7:18.0.+'
compile 'com.goseamless:seamless:2.4.0'
}
let me know if you need more info
please help, Regards.
Android version 22.1.0, the class ActionBarActivity is deprecated. You should use AppCompatActivity
Since you are using com.android.support:appcompat-v7:18.0 you should replace the depracated ActionBarActivity with AppCompatActivity.
**
I was recomended to use ActionBar Activity**
Here is the previous code
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
I wrote new application and followed advice.
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
public class MainActivity extends ActionBarActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionBar =getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.activity_main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
if I use ACtionBarActivity instead of Activity
I catch an error message on phone, when I try to run it.
Please tell me what I do wrong
info from Logcat
07-27 15:14:19.942: I/Process(21715): Sending signal. PID: 21715 SIG: 9
07-27 15:34:38.521: W/dalvikvm(23579): Unable to resolve superclass of Lcom/example/project/MainActivity; (532)
07-27 15:34:38.521: W/dalvikvm(23579): Link of class 'Lcom/example/project/MainActivity;' failed
07-27 15:34:38.521: D/AndroidRuntime(23579): Shutting down VM
07-27 15:34:38.521: W/dalvikvm(23579): threadid=1: thread exiting with uncaught exception (group=0x40ae5210)
07-27 15:34:38.521: E/AndroidRuntime(23579): FATAL EXCEPTION: main
07-27 15:34:38.521: E/AndroidRuntime(23579): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.project/com.example.project.MainActivity}: java.lang.ClassNotFoundException: com.example.project.MainActivity
07-27 15:34:38.521: E/AndroidRuntime(23579): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1891)
07-27 15:34:38.521: E/AndroidRuntime(23579): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
07-27 15:34:38.521: E/AndroidRuntime(23579): at android.app.ActivityThread.access$600(ActivityThread.java:127)
07-27 15:34:38.521: E/AndroidRuntime(23579): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
07-27 15:34:38.521: E/AndroidRuntime(23579): at android.os.Handler.dispatchMessage(Handler.java:99)
07-27 15:34:38.521: E/AndroidRuntime(23579): at android.os.Looper.loop(Looper.java:137)
07-27 15:34:38.521: E/AndroidRuntime(23579): at android.app.ActivityThread.main(ActivityThread.java:4441)
07-27 15:34:38.521: E/AndroidRuntime(23579): at java.lang.reflect.Method.invokeNative(Native Method)
07-27 15:34:38.521: E/AndroidRuntime(23579): at java.lang.reflect.Method.invoke(Method.java:511)
07-27 15:34:38.521: E/AndroidRuntime(23579): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
07-27 15:34:38.521: E/AndroidRuntime(23579): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
07-27 15:34:38.521: E/AndroidRuntime(23579): at dalvik.system.NativeStart.main(Native Method)
07-27 15:34:38.521: E/AndroidRuntime(23579): Caused by: java.lang.ClassNotFoundException: com.example.project.MainActivity
07-27 15:34:38.521: E/AndroidRuntime(23579): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
07-27 15:34:38.521: E/AndroidRuntime(23579): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-27 15:34:38.521: E/AndroidRuntime(23579): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-27 15:34:38.521: E/AndroidRuntime(23579): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
07-27 15:34:38.521: E/AndroidRuntime(23579): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1882)
07-27 15:34:38.521: E/AndroidRuntime(23579): ... 11 more
07-27 15:34:38.531: I/Process(23579): Sending signal. PID: 23579 SIG: 9
edit and export screenshot
http://i.stack.imgur.com/MNfc1.jpg
screenshot of 1-7
http://i.stack.imgur.com/NTpP3.jpg
I've got it worked after moving "Android Private Libraries" and "Android Dependencies" to the top of the list in Order and Export in my application project.
Also I dont have android-support-v7-appcompat in this list.
And in the android-support-v7-appcompat project I dont have support jars in the Order and Export list, but "Android Private Libraries" is checked.
Please, check also the links below:
Setting up ActionBarCompat support library in Eclipse
Implementing Action Bar using ActionBarCompat support library in Android
Make sure the support library is added to the project and exported. You can do so in Eclipse by viewing the properties of your project, clicking Java Build Path, then the Order and Export tab. Then make sure Android Private Libraries is checked.
Did you follow these steps: http://developer.android.com/tools/support-library/setup.html#
Had the exact same stack trace as you with Android Studio. I think it is caused by Android not being able to find a suitable theme for ActionBarActivity.
Anyway, this is how I solved it:
Add the following to your MainActivity in AndroidManifest.xml:
android:theme="#style/Theme.AppCompat.Light"
If it works now - great! If Android Studio cannot find the theme:
Copy the files
sdk/extras/android/support/v7/appcompat/res/values/themes.xml
sdk/extras/android/support/v7/appcompat/res/values/themes_base.xml
to the res/values/ folder in your project.
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.
Recently, I encountered a problem,My android app always stopped unexpectedly and some errors are printed on the log.In fact, I do not know how to debug my program base on logcat which everybody I asked for help wanted.please help me!
Here's my log.
04-22 11:57:20.653: W/dalvikvm(346): VFY: unable to resolve new-instance 41 (Loauth/signpost/commonshttp/CommonsHttpOAuthConsumer;) in LOAuth4Sina/com/AuthActivity;
04-22 11:57:20.653: D/dalvikvm(346): VFY: replacing opcode 0x22 at 0x000f
04-22 11:57:20.673: D/dalvikvm(346): VFY: dead code 0x0011-0039 in LOAuth4Sina/com/AuthActivity;.onCreate (Landroid/os/Bundle;)V
04-22 11:57:20.673: I/dalvikvm(346): Could not find method oauth.signpost.OAuthProvider.setOAuth10a, referenced from method OAuth4Sina.com.AuthActivity.onNewIntent
04-22 11:57:20.693: W/dalvikvm(346): VFY: unable to resolve interface method 41: Loauth/signpost/OAuthProvider;.setOAuth10a (Z)V
04-22 11:57:20.693: D/dalvikvm(346): VFY: replacing opcode 0x72 at 0x0010
04-22 11:57:20.733: W/dalvikvm(346): VFY: unable to resolve exception class 44 (Loauth/signpost/exception/OAuthMessageSignerException;)
04-22 11:57:20.733: W/dalvikvm(346): VFY: unable to find exception handler at addr 0x68
04-22 11:57:20.733: W/dalvikvm(346): VFY: rejected LOAuth4Sina/com/AuthActivity;.onNewIntent (Landroid/content/Intent;)V
04-22 11:57:20.766: W/dalvikvm(346): VFY: rejecting opcode 0x0d at 0x0068
04-22 11:57:20.766: W/dalvikvm(346): VFY: rejected LOAuth4Sina/com/AuthActivity;.onNewIntent (Landroid/content/Intent;)V
04-22 11:57:20.766: W/dalvikvm(346): Verifier rejected class LOAuth4Sina/com/AuthActivity;
04-22 11:57:20.766: W/dalvikvm(346): Class init failed in newInstance call (LOAuth4Sina/com/AuthActivity;)
04-22 11:57:20.785: D/AndroidRuntime(346): Shutting down VM
04-22 11:57:20.785: W/dalvikvm(346): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-22 11:57:20.812: E/AndroidRuntime(346): FATAL EXCEPTION: main
04-22 11:57:20.812: E/AndroidRuntime(346): java.lang.VerifyError: OAuth4Sina.com.AuthActivity
04-22 11:57:20.812: E/AndroidRuntime(346): at java.lang.Class.newInstanceImpl(Native Method)
04-22 11:57:20.812: E/AndroidRuntime(346): at java.lang.Class.newInstance(Class.java:1429)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.os.Handler.dispatchMessage(Handler.java:99)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.os.Looper.loop(Looper.java:123)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-22 11:57:20.812: E/AndroidRuntime(346): at java.lang.reflect.Method.invokeNative(Native Method)
04-22 11:57:20.812: E/AndroidRuntime(346): at java.lang.reflect.Method.invoke(Method.java:521)
04-22 11:57:20.812: E/AndroidRuntime(346): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-22 11:57:20.812: E/AndroidRuntime(346): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-22 11:57:20.812: E/AndroidRuntime(346): at dalvik.system.NativeStart.main(Native Method)