When I created this test Android project, Fire suggested org.somesuch.projectname as the folder/project name. I changed it to something else (ex.: “MyProject (Android)”) and made sure to update the project settings to use the proper default package name. The app builds but when I try to launch it I get a ClassNotFoundException:
2018-11-15 13:53:23.428 5846-5846/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.somesuch.projectname, PID: 5846
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.somesuch.projectname/org.somesuch.projectname.ProjectsActivity}: java.lang.ClassNotFoundException: Didn't find class "org.somesuch.projectname.ProjectsActivity" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/org.somesuch.projectname-j7kUBIBEaKqTwZY5xOcybA==/base.apk"],nativeLibraryDirectories=[/data/app/org.somesuch.projectname-j7kUBIBEaKqTwZY5xOcybA==/lib/x86_64, /system/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2843)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.somesuch.projectname.ProjectsActivity" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/org.somesuch.projectname-j7kUBIBEaKqTwZY5xOcybA==/base.apk"],nativeLibraryDirectories=[/data/app/org.somesuch.projectname-j7kUBIBEaKqTwZY5xOcybA==/lib/x86_64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:69)
at android.app.Instrumentation.newActivity(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2831)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/AppCompatActivity;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 15 more
Caused by: java.lang.ClassNotFoundException: android.support.v7.app.AppCompatActivity
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 18 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/FragmentActivity;
... 18 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.app.FragmentActivity" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/org.somesuch.projectname-j7kUBIBEaKqTwZY5xOcybA==/base.apk"],nativeLibraryDirectories=[/data/app/org.somesuch.projectname-j7kUBIBEaKqTwZY5xOcybA==/lib/x86_64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 18 more
Your application app manifest is likely still referencing the activity in the original package name.
Had you merely changed the directory name you might have been Ok (as long as any file path references were correctly updated); this problem has likely arisen because you also changed the default package name (the two things don’t have to be the same) and there are things in the original project which will still be based on the original package name, irrespective of the names of folders in the file system.
Qualification of activity class names in the manifest is one such thing.
I deleted older builds of the test app from the emulator and now the app does not launch. I get a dialog box from Fire saying:
The process failed to start with the following error: Starting: Intent { cmp=org.somesuch.projectname/.ProjectsActivity }
Error type 3
Error: Activity class {org.somesuch.projectname/org.somesuch.projectname.ProjectsActivity} does not exist.
For now, oi assume the issue is specific to debugging only, and the app launches fine standalone. What happens is that — different form debugging on other platforms — the debugger on Android doesn’t just launch “the app”, but a specific activity. in this case. Fire is passing org.somesuch.projectname.ProjectsActivity as the activity it want to launch — and that class does not exist.
The error could be omg two sides: (a) this is the right activity you want to launch, but your class is named badly or (b) your class is named as it should be but this is not its name.
Now, the name of your activity class is (summing you’re using Swift, as I recall?) composed of the RootNamespace setting of your project, and the actual name you give to it in code. (in other languages, the namespace too is in code, at the top of the file).
So, I recommend checking of this are set as you expect, to make sure your activity class gets the name you want it to have. Chances are when you renamed your package, you didn’t change the root namespace, so your classes are still named with the old namespace.
The name of the activity to launch can be set in Fire’s project settings, under the “Start-Up Activity” / AndroidDebugActivity setting. When not set explicitly, it is determined by looking at all the activities in your manifest, and picking the one with android.intent.action.MAIN set. the name configured fo that activity will be used.
Can you check if either that project setting is set or, if not, an unexpected name is specified in the manifest file for the main activity?
The names (root namespace + class name + startup activity) should be correct in the sample project I sent you via PM. They are not the same as the ones in this post but I did check them.
It seems I get a timeout starting the app if I use .ProjectsActivity (and then get the Fire popup mentioned a few replies up). If I use the full org.somesuch.projectname.ProjectsActivity name (and ensure the project settings match that activity name) the app seems to launch but then throws the ClassNotFoundException described in the original post.
Ok, good. that means we solved the second problem then. Form today’s upcoming build. the debugger will handle getting a name without the namespace, and the IDE is fixed to provide the full names in the picker.
So as for the original issue: I assume “org.somesuch.projectname.ProjectsActivity” is the NEW name that the class SHOULD have but its not there? if you unzip the .jar or the .dex file, so you see the class in there?
Also, is the exception actually terminal? it seems that Android checks a multitude of paths for the class (not all of which will have it, of course), and each attempt throws an exception. thats “normal” (for what Java considers “normal”), and the app might still run in the end?
It seems to be. The app begins launching and then poofs. I am watching Logcat in Android Studio as Fire seems oblivious to what’s happening in this case.
Ok, so the class seems to be there, id say the exceptions are probably misleading then. is there nothing else isn logcat (which btw also shows in Fire, third tab in the debug console) when the app crashes? usually there’s an explicit exception and call stack…
Hmm. logcat should be spewing out a billion lines of stuff per second, not just this one message. sure it’s it being filtered? try running raw add logcat in terminal.
2018-11-16 10:42:53.643 17421-17421/? I/ncontrols.focu: The ClassLoaderContext is a special shared library. 2018-11-16 10:42:53.819 17421-17421/? I/ncontrols.focu: Rejecting re-init on previously-failed class java.lang.Class<android.support.v7.app.AppCompatActivity>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/FragmentActivity;