ClassNotFoundException: Could not find class: but Class is Exist - android

I Found ClassNotFoundException in my apps, but The Class is Exist.. Here's the project workspace
I was working with lots libraries,
But i have problem while createing build path and depedencies..
The Logcat Show Msgs:
12-10 00:36:56.840: W/System.err(12666): java.lang.ClassNotFoundException: Could not find class: org.holoeverywhere.internal.AlertController.RecycleListView
12-10 00:36:56.845: W/System.err(12666): at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:318)
12-10 00:36:56.845: W/System.err(12666): at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:325)
12-10 00:36:56.845: W/System.err(12666): at org.holoeverywhere.LayoutInflater$HoloFactoryMerger.onCreateView(LayoutInflater.java:63)
12-10 00:36:56.845: W/System.err(12666): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:660)
12-10 00:36:56.845: W/System.err(12666): at android.view.LayoutInflater.inflate(LayoutInflater.java:457)
12-10 00:36:56.845: W/System.err(12666): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:278)
12-10 00:36:56.845: W/System.err(12666): at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
12-10 00:36:56.845: W/System.err(12666): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:263)
12-10 00:36:56.845: W/System.err(12666): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:258)
12-10 00:36:56.845: W/System.err(12666): at org.holoeverywhere.internal.AlertController$AlertParams.createListView(AlertController.java:144)
12-10 00:36:56.845: W/System.err(12666): at org.holoeverywhere.internal.AlertController$AlertParams.apply(AlertController.java:130)
12-10 00:36:56.845: W/System.err(12666): at org.holoeverywhere.app.AlertDialog$Builder.create(AlertDialog.java:41)
12-10 00:36:56.845: W/System.err(12666): at org.isolaa.droidquiz.DashboardActivity$QuizFragment.onItemLongClick(DashboardActivity.java:455)
12-10 00:36:56.850: W/System.err(12666): at android.widget.AbsListView.performLongPress(AbsListView.java:2703)
12-10 00:36:56.850: W/System.err(12666): at android.widget.AbsListView$CheckForLongPress.run(AbsListView.java:2651)
12-10 00:36:56.850: W/System.err(12666): at android.os.Handler.handleCallback(Handler.java:587)
12-10 00:36:56.850: W/System.err(12666): at android.os.Handler.dispatchMessage(Handler.java:92)
12-10 00:36:56.850: W/System.err(12666): at android.os.Looper.loop(Looper.java:132)
12-10 00:36:56.850: W/System.err(12666): at android.app.ActivityThread.main(ActivityThread.java:4123)
12-10 00:36:56.850: W/System.err(12666): at java.lang.reflect.Method.invokeNative(Native Method)
12-10 00:36:56.850: W/System.err(12666): at java.lang.reflect.Method.invoke(Method.java:491)
12-10 00:36:56.850: W/System.err(12666): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
12-10 00:36:56.855: W/System.err(12666): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
12-10 00:36:56.855: W/System.err(12666): at dalvik.system.NativeStart.main(Native Method)
12-10 00:36:56.855: W/System.err(12666): android.view.InflateException: Binary XML file line #2: Error inflating class org.holoeverywhere.internal.AlertController.RecycleListView
12-10 00:36:56.855: W/System.err(12666): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:682)
12-10 00:36:56.855: W/System.err(12666): at android.view.LayoutInflater.inflate(LayoutInflater.java:457)
12-10 00:36:56.855: W/System.err(12666): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:278)
12-10 00:36:56.855: W/System.err(12666): at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
12-10 00:36:56.855: W/System.err(12666): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:263)
12-10 00:36:56.855: W/System.err(12666): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:258)
12-10 00:36:56.855: W/System.err(12666): at org.holoeverywhere.internal.AlertController$AlertParams.createListView(AlertController.java:144)
12-10 00:36:56.860: W/System.err(12666): at org.holoeverywhere.internal.AlertController$AlertParams.apply(AlertController.java:130)
12-10 00:36:56.860: W/System.err(12666): at org.holoeverywhere.app.AlertDialog$Builder.create(AlertDialog.java:41)
12-10 00:36:56.860: W/System.err(12666): at org.isolaa.droidquiz.DashboardActivity$QuizFragment.onItemLongClick(DashboardActivity.java:455)
12-10 00:36:56.860: W/System.err(12666): at android.widget.AbsListView.performLongPress(AbsListView.java:2703)
12-10 00:36:56.860: W/System.err(12666): at android.widget.AbsListView$CheckForLongPress.run(AbsListView.java:2651)
12-10 00:36:56.860: W/System.err(12666): at android.os.Handler.handleCallback(Handler.java:587)
12-10 00:36:56.860: W/System.err(12666): at android.os.Handler.dispatchMessage(Handler.java:92)
12-10 00:36:56.860: W/System.err(12666): at android.os.Looper.loop(Looper.java:132)
12-10 00:36:56.860: W/System.err(12666): at android.app.ActivityThread.main(ActivityThread.java:4123)
12-10 00:36:56.860: W/System.err(12666): at java.lang.reflect.Method.invokeNative(Native Method)
12-10 00:36:56.865: W/System.err(12666): at java.lang.reflect.Method.invoke(Method.java:491)
12-10 00:36:56.865: W/System.err(12666): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
12-10 00:36:56.865: W/System.err(12666): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
12-10 00:36:56.865: W/System.err(12666): at dalvik.system.NativeStart.main(Native Method)
12-10 00:36:56.865: W/System.err(12666): Caused by: java.lang.ClassNotFoundException: org.holoeverywhere.internal.AlertController.RecycleListView in loader dalvik.system.PathClassLoader[/data/app/org.isolaa.droidquiz-1.apk]
12-10 00:36:56.870: W/System.err(12666): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:251)
12-10 00:36:56.870: W/System.err(12666): at java.lang.ClassLoader.loadClass(ClassLoader.java:540)
12-10 00:36:56.870: W/System.err(12666): at java.lang.ClassLoader.loadClass(ClassLoader.java:500)
12-10 00:36:56.870: W/System.err(12666): at android.view.LayoutInflater.createView(LayoutInflater.java:542)
12-10 00:36:56.870: W/System.err(12666): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:671)
12-10 00:36:56.870: W/System.err(12666): ... 20 more

Make sure that, if you're using eclipse, they're configured in the build path. That way it's included in the APK. Furthermore, your DroidQuiz.apk turns into DroidQuiz-1.apk because of how ADB transfers the file. It doesn't matter what you call the apk, it'll do the same thing.

Related

"Error obtaining view hierarchy: Unexpected error: empty view hierarchy" when launch Layout Inspector

I get the error message when I launch Layout Inspector: "Error obtaining view hierarchy: Unexpected error: empty view hierarchy".
Also in Logcat there is an exception:
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater I/art: Exception thrown by dispatcher for 0x56555254
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: java.lang.NoClassDefFoundError: android.graphics.drawable.Icon
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at java.lang.Class.getDexCacheType(Class.java:479)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at java.lang.reflect.ArtMethod.getDexCacheType(ArtMethod.java:236)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at java.lang.reflect.ArtMethod.getParameterTypes(ArtMethod.java:176)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at java.lang.reflect.Method.getParameterTypes(Method.java:174)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at java.lang.Class.getDeclaredMethods(Class.java:802)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.getExportedPropertyMethods(ViewDebug.java:1118)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.exportMethods(ViewDebug.java:1209)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:1155)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:1141)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.dumpView(ViewDebug.java:1058)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:997)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:992)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.view.ViewDebug.dump(ViewDebug.java:855)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.ddm.DdmHandleViewDebug.dumpHierarchy(DdmHandleViewDebug.java:235)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at android.ddm.DdmHandleViewDebug.handleChunk(DdmHandleViewDebug.java:134)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at org.apache.harmony.dalvik.ddmc.DdmServer.dispatch(DdmServer.java:171)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.graphics.drawable.Icon" on path: DexPathList[[zip file "/data/app/com.tst.nikita.yandextranslater-2/base.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.tst.nikita.yandextranslater-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.tst.nikita.yandextranslater-2/lib/arm, /vendor/lib, /system/lib]]
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at libcore.reflect.InternalNames.getClass(InternalNames.java:53)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: ... 24 more
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: Suppressed: java.lang.ClassNotFoundException: android.graphics.drawable.Icon
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at java.lang.Class.classForName(Native Method)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
12-10 23:46:56.812 18833-18840/com.tst.nikita.yandextranslater W/System.err: at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
12-10 23:46:56.822 18833-18840/com.tst.nikita.yandextranslater W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
12-10 23:46:56.822 18833-18840/com.tst.nikita.yandextranslater W/System.err: ... 26 more
12-10 23:46:56.822 18833-18840/com.tst.nikita.yandextranslater W/System.err: Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
I use Android Studio 3.0.1.
Device - Samsung Galaxy S4 GT-I9505 with Android 5.0.1.
From manifest file:
compileSdkVersion 26
buildToolsVersion '26.0.3'
minSdkVersion 21
targetSdkVersion 26
I have noticed that this can also occur when using bluetooth. When i turned bluetooth off so that my code stopped scanning i could capture the View Hierarchy just fine.

error on installtion of apk

When i run my java code in the emulator or the real device, i every once in a while get this error. However, the app goes on and installs well. Since the error below appears in red text in my eclipse log, i have been forced to ask.. Is it an error that can cause significant problems when i release the app eventually or its something i should ignore? My guess is that i can use a try catch statement to capture the NullPointerException but i have no clue at what point in my MainActivity this error is generated.
12-10 20:15:44.268: E/AndroidRuntime(1126): FATAL EXCEPTION: main
12-10 20:15:44.268: E/AndroidRuntime(1126): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.LoadedApk.makeApplication(LoadedApk.java:501)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4124)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.ActivityThread.access$1300(ActivityThread.java:130)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.os.Handler.dispatchMessage(Handler.java:99)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.os.Looper.loop(Looper.java:137)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.ActivityThread.main(ActivityThread.java:4745)
12-10 20:15:44.268: E/AndroidRuntime(1126): at java.lang.reflect.Method.invokeNative(Native Method)
12-10 20:15:44.268: E/AndroidRuntime(1126): at java.lang.reflect.Method.invoke(Method.java:511)
12-10 20:15:44.268: E/AndroidRuntime(1126): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
12-10 20:15:44.268: E/AndroidRuntime(1126): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-10 20:15:44.268: E/AndroidRuntime(1126): at dalvik.system.NativeStart.main(Native Method)
12-10 20:15:44.268: E/AndroidRuntime(1126): Caused by: java.lang.NullPointerException
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:377)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.LoadedApk.getClassLoader(LoadedApk.java:320)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.LoadedApk.makeApplication(LoadedApk.java:493)
12-10 20:15:44.268: E/AndroidRuntime(1126): ... 11 more

class cast exception in one project not in other

I was following GCM Tutorial and I took utmost care in making no mistake and implementing same code in my project. But when I run the project I am getting ClassCast exception. I thought I would have missed something so I downloaded the source from that post and copied each and every line carefully in my project but still I am getting same exception. Please help solve the error.
12-10 23:41:25.812: E/AndroidRuntime(9549): FATAL EXCEPTION: main
12-10 23:41:25.812: E/AndroidRuntime(9549): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.exaple.oldgcm/com.exaple.oldgcm.MainActivity}: java.lang.ClassCastException: android.app.Application cannot be cast to com.exaple.oldgcm.Controller
12-10 23:41:25.812: E/AndroidRuntime(9549): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
12-10 23:41:25.812: E/AndroidRuntime(9549): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
12-10 23:41:25.812: E/AndroidRuntime(9549): at android.app.ActivityThread.access$600(ActivityThread.java:128)
12-10 23:41:25.812: E/AndroidRuntime(9549): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
12-10 23:41:25.812: E/AndroidRuntime(9549): at android.os.Handler.dispatchMessage(Handler.java:99)
12-10 23:41:25.812: E/AndroidRuntime(9549): at android.os.Looper.loop(Looper.java:137)
12-10 23:41:25.812: E/AndroidRuntime(9549): at android.app.ActivityThread.main(ActivityThread.java:4517)
12-10 23:41:25.812: E/AndroidRuntime(9549): at java.lang.reflect.Method.invokeNative(Native Method)
12-10 23:41:25.812: E/AndroidRuntime(9549): at java.lang.reflect.Method.invoke(Method.java:511)
12-10 23:41:25.812: E/AndroidRuntime(9549): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
12-10 23:41:25.812: E/AndroidRuntime(9549): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
12-10 23:41:25.812: E/AndroidRuntime(9549): at dalvik.system.NativeStart.main(Native Method)
12-10 23:41:25.812: E/AndroidRuntime(9549): Caused by: java.lang.ClassCastException: android.app.Application cannot be cast to com.exaple.oldgcm.Controller
12-10 23:41:25.812: E/AndroidRuntime(9549): at com.exaple.oldgcm.MainActivity.onCreate(MainActivity.java:33)
12-10 23:41:25.812: E/AndroidRuntime(9549): at android.app.Activity.performCreate(Activity.java:4470)
12-10 23:41:25.812: E/AndroidRuntime(9549): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
12-10 23:41:25.812: E/AndroidRuntime(9549): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
12-10 23:41:25.812: E/AndroidRuntime(9549): ... 11 more
I believe the problem is that you haven't set an Application name in your manifest.
Refer to this solution:
android classcastexception at android.app.Application

Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY on android 2.3.4

My android is W806 with MIUI system(andrid 2.3.4, could be downloaded at
http://119.147.150.88/gdown_group321/M00/01/BB/d5OWWE-TiE0AAAAABFRc6HZ-Izc1688998/MIUI_W806_updateEX.zip?k=rscjHEFnZBVxNvfDqVP3Iw&t=1355119512&u=712526008-27587528-bjpdc2a8&s=51200&file=MIUI_W806_updateEX.zip
)
I follow this example: http://mirnauman.wordpress.com/2012/01/30/using-google-maps-in-android-development-tutorial-part-1/, I have chosen Google API of 2.3.3 downloaded from SDK manager. But I got the problem Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY.
I try to search solutions in google and stackoverflow, but no one fits me...I have some logcat, and here it is:
12-10 16:38:19.820: W/dalvikvm(5906): Unable to resolve superclass of Lcom/example/googlemapapp/GooglemapsActivity; (463)
12-10 16:38:19.820: W/dalvikvm(5906): Link of class 'Lcom/example/googlemapapp/GooglemapsActivity;' failed
12-10 16:38:19.820: D/AndroidRuntime(5906): Shutting down VM
12-10 16:38:19.820: W/dalvikvm(5906): threadid=1: thread exiting with uncaught exception (group=0x4011b560)
12-10 16:38:19.830: E/AndroidRuntime(5906): FATAL EXCEPTION: main
12-10 16:38:19.830: E/AndroidRuntime(5906): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.googlemapapp/com.example.googlemapapp.GooglemapsActivity}: java.lang.ClassNotFoundException: com.example.googlemapapp.GooglemapsActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.googlemapapp-1.apk]
12-10 16:38:19.830: E/AndroidRuntime(5906): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
12-10 16:38:19.830: E/AndroidRuntime(5906): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
12-10 16:38:19.830: E/AndroidRuntime(5906): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-10 16:38:19.830: E/AndroidRuntime(5906): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
12-10 16:38:19.830: E/AndroidRuntime(5906): at android.os.Handler.dispatchMessage(Handler.java:99)
12-10 16:38:19.830: E/AndroidRuntime(5906): at android.os.Looper.loop(Looper.java:130)
12-10 16:38:19.830: E/AndroidRuntime(5906): at android.app.ActivityThread.main(ActivityThread.java:3684)
12-10 16:38:19.830: E/AndroidRuntime(5906): at java.lang.reflect.Method.invokeNative(Native Method)
12-10 16:38:19.830: E/AndroidRuntime(5906): at java.lang.reflect.Method.invoke(Method.java:507)
12-10 16:38:19.830: E/AndroidRuntime(5906): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-10 16:38:19.830: E/AndroidRuntime(5906): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-10 16:38:19.830: E/AndroidRuntime(5906): at dalvik.system.NativeStart.main(Native Method)
12-10 16:38:19.830: E/AndroidRuntime(5906): Caused by: java.lang.ClassNotFoundException: com.example.googlemapapp.GooglemapsActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.googlemapapp-1.apk]
12-10 16:38:19.830: E/AndroidRuntime(5906): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
12-10 16:38:19.830: E/AndroidRuntime(5906): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
12-10 16:38:19.830: E/AndroidRuntime(5906): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
12-10 16:38:19.830: E/AndroidRuntime(5906): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
12-10 16:38:19.830: E/AndroidRuntime(5906): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
12-10 16:38:19.830: E/AndroidRuntime(5906): ... 11 more
Looks like you are missing some information in your android project files and/or AndroidManifest.xml ?
Try and look at my earlier answer to a somewhat similar answers:
1. Answer
2. Answer

Select photo from Android Gallery then display it in a fragment?

I am developing an Android app using fragments and would like the user to be able to pick an image for scanning purposes. I have a fragment that allows the user to select their desired source (camera, hand-drawn, or gallery). When the user selects Gallery, then another fragment should display the image. I already know how I am supposed to get the image into an ImageView but keep getting this error with the Fragments:
12-10 17:30:26.405: E/AndroidRuntime(6560): FATAL EXCEPTION: main
12-10 17:30:26.405: E/AndroidRuntime(6560): java.lang.RuntimeException: Unable to resume activity {org.nathanmoos.artificialIntelligence.clockreader/org.nathanmoos.artificialIntelligence.clockreader.ChooseSourceActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2241)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2256)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:965)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.os.Handler.dispatchMessage(Handler.java:99)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.os.Looper.loop(Looper.java:130)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.app.ActivityThread.main(ActivityThread.java:3835)
12-10 17:30:26.405: E/AndroidRuntime(6560): at java.lang.reflect.Method.invokeNative(Native Method)
12-10 17:30:26.405: E/AndroidRuntime(6560): at java.lang.reflect.Method.invoke(Method.java:507)
12-10 17:30:26.405: E/AndroidRuntime(6560): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
12-10 17:30:26.405: E/AndroidRuntime(6560): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
12-10 17:30:26.405: E/AndroidRuntime(6560): at dalvik.system.NativeStart.main(Native Method)
12-10 17:30:26.405: E/AndroidRuntime(6560): Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.view.ViewGroup.addViewInner(ViewGroup.java:1976)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.view.ViewGroup.addView(ViewGroup.java:1871)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.view.ViewGroup.addView(ViewGroup.java:1828)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.view.ViewGroup.addView(ViewGroup.java:1808)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.support.v4.app.NoSaveStateFrameLayout.wrap(NoSaveStateFrameLayout.java:40)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:848)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1053)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:622)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1371)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:499)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.app.Activity.performStart(Activity.java:3791)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.app.Activity.performRestart(Activity.java:3821)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.app.Activity.performResume(Activity.java:3826)
12-10 17:30:26.405: E/AndroidRuntime(6560): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2231)
12-10 17:30:26.405: E/AndroidRuntime(6560): ... 10 more
Basically it looks like there's an issue with my FragmentTransaction usage. Here's my code:
frag = new GalleryFragment();
frag.setImagePath(imagePath);
FragmentTransaction tx = getSupportFragmentManager().beginTransaction();
tx.replace(R.id.fragment_space, frag);
tx.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
and my layout file:
<FrameLayout
android:id="#+id/fragment_space"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="65"/>
Never mind I figured this one out. It's the same solution as:
Android Fragment (with Compatibility Package on 2.3.3) creates "Specified child already has a parent error"
and
Error swapping / adding an XML Fragment
.

Categories

Resources