简体   繁体   中英

My App won't run after clicking on it in Android Emulator

Please i need a help, i think i have made a mistake in compiling my app as i cannot open it on Android Emulator it say's "Unfortunately MyApp has stopped"

App class

 import android.app.Application; import android.content.Context; import android.support.multidex.MultiDex; import com.c2call.sdk.pub.affiliate.AffiliateCredentials; import com.c2call.sdk.pub.core.C2CallSdk; public class App extends Application { @Override public void onCreate() { super.onCreate(); /* The affiliate ID and Secret from the C2Call SDK DevArea Note: In a custom App you will have to change these to your own credentials */ String affid = "Affiliateid"; String secret = "Secretid"; final AffiliateCredentials credentials = new AffiliateCredentials(affid, getPackageName(), secret); /* Initialise the C2CallSdk instance. This must be called before using any C2Call functionality */ C2CallSdk.instance().init((Application) getApplicationContext(), credentials); /* Set a custom StartControl and override the #openMain() method. This method will be called from the Login controller after a successful login. In this Demo we simply open the friend list of the user. */ C2CallSdk.instance().setStartControl(new StartControl()); } @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); } } 

Build.Gradle

 buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.3.1' } } apply plugin: 'com.android.application' task copyLibs(type: Copy){ description 'Copy lib-c2callsdk.aar to libs' from '../../lib-c2callsdk/app/build/outputs/aar' into 'libs' include('*.aar') } preBuild.dependsOn copyLibs android { compileSdkVersion "Google Inc.:Google APIs:23" buildToolsVersion "23.0.1" defaultConfig { applicationId "com.chatibo.chatibo" minSdkVersion 14 targetSdkVersion 19 versionCode 1 versionName "1.0.0" multiDexEnabled = true } dexOptions { incremental true javaMaxHeapSize "4g" } lintOptions { checkReleaseBuilds false } } repositories { flatDir { dirs 'libs' } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile(name: 'lib-c2callsdk', ext: 'aar') compile 'com.android.support:support-v13:+' compile 'com.google.android.gms:play-services:7.5.0' compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:design:23.1.0' } 

Here is the Gradle Build output message after the run is finished, you can check through it if it shows anything wrong:

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:assembleDebug]
:app:copyLibs UP-TO-DATE
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72310Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2310Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72200Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72310Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV132310Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42310Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable750Library UP-TO-DATE
:app:prepareLibC2callsdkLibrary UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl UP-TO-DATE
:app:processDebugAndroidTestManifest UP-TO-DATE
:app:compileDebugAndroidTestRenderscript UP-TO-DATE
:app:generateDebugAndroidTestBuildConfig UP-TO-DATE
:app:generateDebugAndroidTestAssets UP-TO-DATE
:app:mergeDebugAndroidTestAssets UP-TO-DATE
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources UP-TO-DATE
:app:mergeDebugAndroidTestResources UP-TO-DATE
:app:processDebugAndroidTestResources UP-TO-DATE
:app:generateDebugAndroidTestSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:collectDebugMultiDexComponents UP-TO-DATE
:app:packageAllDebugClassesForMultiDex
:app:shrinkDebugMultiDexComponents
:app:createDebugMainDexClassList
:app:dexDebug
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.LogFactory$4) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.LogFactory$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.LogFactory$2) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.LogFactory$3) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.LogFactory$5) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.LogFactory$6) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.LogFactoryImpl$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.LogFactoryImpl$2) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.LogFactoryImpl$3) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.WeakHashtable$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.SimpleLog$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.amazonaws.services.s3.model.a.d) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
:app:validateDebugSigning
:app:packageDebug
:app:zipalignDebug
:app:assembleDebug
Information:BUILD SUCCESSFUL
Information:Total time: 5 mins 29.016 secs
Information:0 errors
Information:0 warnings
Information:See complete output in console

The logcat

 11-11 05:47:46.982 2602-2602/? I/art: Not late-enabling -Xcheck:jni (already on) 11-11 05:47:46.983 2602-2602/? I/art: Late-enabling JIT 11-11 05:47:47.030 2602-2602/? I/art: JIT created with code_cache_capacity=2MB compile_threshold=1000 11-11 05:47:47.237 2602-2602/? D/AndroidRuntime: Shutting down VM 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: FATAL EXCEPTION: main 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: Process: com.chatibo.chatibo, PID: 2602 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: java.lang.RuntimeException: Unable to instantiate application com.chatibo.chatibo.App: java.lang.ClassNotFoundException: Didn't find class "com.chatibo.chatibo.App" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.chatibo.chatibo-1/base.apk"],nativeLibraryDirectories=[/data/app/com.chatibo.chatibo-1/lib/x86, /data/app/com.chatibo.chatibo-1/base.apk!/lib/x86, /vendor/lib, /system/lib]] 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.app.LoadedApk.makeApplication(LoadedApk.java:578) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4680) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.app.ActivityThread.-wrap1(ActivityThread.java) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.chatibo.chatibo.App" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.chatibo.chatibo-1/base.apk"],nativeLibraryDirectories=[/data/app/com.chatibo.chatibo-1/lib/x86, /data/app/com.chatibo.chatibo-1/base.apk!/lib/x86, /vendor/lib, /system/lib]] 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:511) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:469) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.app.Instrumentation.newApplication(Instrumentation.java:981) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.app.LoadedApk.makeApplication(LoadedApk.java:573) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4680) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.app.ActivityThread.-wrap1(ActivityThread.java) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: Suppressed: java.lang.ClassNotFoundException: com.chatibo.chatibo.App 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at java.lang.Class.classForName(Native Method) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at java.lang.BootClassLoader.findClass(ClassLoader.java:781) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:504) 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: ... 12 more 11-11 05:47:47.237 2602-2602/? E/AndroidRuntime: Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available 11-11 05:47:50.888 2602-2602/? I/Process: Sending signal. PID: 2602 SIG: 9 

Any Help would be appreciated. Thanks

7520-7520/? E/AndroidRuntime: FATAL EXCEPTION: main 11-10 15:52:34.577 7520-7520/? E/AndroidRuntime: Process: com.chatibo.chatibo, PID: 7520 11-10 15:52:34.577 7520-7520/? E/AndroidRuntime: java.lang.RuntimeException: Unable to instantiate application com.chatibo.chatibo.App: java.lang.ClassNotFoundException: Didn't find class "com.chatibo.chatibo.App" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.chatibo.chatibo-1/base.apk"],nativeLibraryDirectories=[/data/app/com.chatibo.chatibo-1/lib/x86, /data/app/com.chatibo.chatibo-1/base.apk!/lib/x86, /vendor/lib, /system/lib]]

the log file states: Didn't find class "com.chatibo.chatibo.App on path. It sounds like there is a file path not matching what you need. Check all the paths to find out if they match up with what you need.

Based off the error posted:

required: Application,AffiliateCredentials
found: Context,String,AffiliateCredentials

try to change the init() call to be this:

C2CallSdk.instance().init((Application) getApplicationContext(), credentials);

instead of

C2CallSdk.instance().init(
                getApplicationContext(),
                getPackageName(),
                credentials);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM