I've been working on an app for some time now and recently it keeps crashing on startup.
The error that causes it to crash is java.lang.ClassNotFoundException on my launcher activity. I've launched and debugged my app tons of times with no problems so I think I must've accidently changed something in a configuration file somewhere but I can't work out where.
I've checked the manifest file and there's nothing wrong, the path for the activity is correct and I've looked through the class file itself and again the package prefix is correct. I've also gone through the file directory and there's nothing wrong there either.
I tried changing the launcher activity to another one inside the same application and it runs with no problem, I've also tried creating a new launcher activity and that runs with no problem.
However, when I create a new activity and paste in all the code from the one that crashes the whole app crashes again. Even when the new activity has a different class name.
Also just before the app crashes I get two warnings:
Unable to resolve superclass of Lcom/bend/... and Link of class 'Lcom/bend/... failed
Now everything in my app is com.bend... NOT Lcom.bend... but I can't find anywhere where it's written Lcom. But I don't know if that's the cause of the problem or just a change the system does.
I know it's a real obscure problem but I just cannot figure it out. Any help would be awesome.
EDIT: I've just tried running another app I've done that's has a similar design and it's doing exactly the same thing.
I've just recently updated the SDK. Could that be the problem?
I've just solved it by creating an entirely new Android project and copying the java files and resources etc. into the new project.
I think it might have been the v4 support library that was causing the problem. I'm using a lot of Fragments so was relying heavily on it. Though I tried replacing the .jar file from an app that worked and it didn't seem to help...
In any case it was nothing to do with any of the classes or the manifest file.
Related
I have an app written in Kotlin which contains an Activity that is a child of NativeActivity. It runs fine.
I cloned that app to create another one with similar functionality, and it deploys the APK just fine - but it crashes at runtime because ANativeActivty_OnCreate() is an unknown symbol.
I don't understand how it could even link and get packaged without that symbol being known, but also because it works fine in the original app. I'm at a loss for where to look for the cause of this issue. Has this happened to anyone else? What are some things I can try to resolve the problem?
Noob Android Studio 3.6.1 on Mac Mojave developer here. I have a very simple app with a few activities. Every so often, the Kotlin class for one of the activities will complain of an unresolved reference to the corresponding layout XML file.
For example, in the Kotlin Class (TraceActivity.kt), I have the following code:
setContentView(R.layout.activity_trace)
and the corresponding XML file lives at:
MyApp/app/src/main/res/layout/activity_trace.xml
All pretty standard stuff I reckon. But setContentView would complain that it couldn't resolve activity_trace. This has happened on a few occasions, and I discovered that restarting would resolve the problem. But this morning, it isn't helping. And it's also started complaining about some of the strings I've added to strings.xml
I managed to get round the errors by making use of the full names for each of the items e.g.
com.mysite.myapp.R.layout.activity_trace
and
com.mysite.myapp.R.string.my_message
So my guess (as a noob) that somewhere it's losing track of where it is. And yet my other activities are perfectly happy when I omit the full location. Can anyone offer some insight here? Thank you - SO is awesome.
I know this is a rare question. Even if there are people using MyEclipse for Android development is doubted :(
The annoying thing is that after I modified my Android project (like an Activity class of a xml file), the project remained the same as it was when I imported it.
I thought there is an important feature that demonstrates this error: When I run my Android project and the console reported that "Activity not started, its current task has been brought to the front". This line occurs because the project didnt changed while as a matter of fact I did change the project and saved it.
Is there anyone has the same problem like me?
-------------add in Oct. 28-------------------
This was what I did: first, I modified one of my activities by commenting out the Toast functions; and then, I ran it however the Toast line still showed on my Genymotion emulator
My project consists of a main project and two library projects. I am using the manifest merging. One of library projects has a service running in a separate process with intention that it gets used by other similar apps which include my framework.
I am experiencing a very strange behavior where even though I update code in the service part, my app is still using the previous old version of it. Reinstalling the app does not help either.
Does anyone know what is a cause of this problem and how to resolve it?
UPDATE: The problem occurs only if I use startService(new Intent ("service action"))
I've seen a number of people have problems because they don't add the activity to the manifest file. I've suffered from this myself.
This seems like such a simple/common problem yet I have no clue how I'm supposed to figure that out from the Eclipse IDE.
Is the debugging output of Eclipse totally useless or is there something I'm missing?
You can actually find that out if you're viewing logcat in the DDMS-tab of Eclipse. If you haven't added it, it throws an ActivityNotFoundException or similar exception, and even asks if one remembered to add the actitivy to the manifest.