NoClassDefFoundError among others...Android - android

I am working on an Android application (I will call this ProjectA) that is attempting to login to a server through a web service call. This web service call is in another package within my workspace (I will call this ProjectB). I include the jar of ProjectB in ProjectA, and run it. I get this error:
Caused by: java.lang.NoClassDefFoundError: org.apache.commons.configuration.PropertiesConfiguration
Then, I tried adding several uses-library tags in my manifest. I add this:
< uses-library android:name="org.apache.commons.configuration.PropertiesConfiguration" />
I get the following error:
Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
Please check logcat output for more details.
I tried Googling this error, but the only thing that ever seems to come up in the searches with this second error is about the Google API's (mostly referring to the Map). If someone could help out, that would be great. Please let me know if you need more information.

Your app, or some code that it uses, uses the Apache Commons Configuration components. You will need to obtain the .jar file for this code (which may have been supplied with whatever library you're using that needs it) and add it to your libs/ directory to have it built in to your app.

Related

How can I set a breakpoint in an internal class of an Android library?

I'm trying to help debug Wallet Connect (v2) integration into an Android app written in Kotlin (I know Java, but am not an Android/Kotlin dev myself).
I get an exception from the com.walletconnect:android-core library and would like to set a breakpoint (or insert some debug printing) for inspection.
Even though I would appreciate any help with Wallet Connect directly, the main purpose of this question is to figure out how I can go about debugging this myself.
The library is included in Gradle by
implementation("com.walletconnect:android-core:1.3.0")
implementation("com.walletconnect:sign:2.1.0")
The error comes from JsonRpcInteractor (seemlingly method manageSubscriptions) (no idea why they're wrapping it in java.lang.InternalError as it's not a JVM error):
java.lang.InternalError: JsonRpcInteractor: Received unknown object type
at com.walletconnect.android.impl.json_rpc.domain.JsonRpcInteractor$handleError$1.invokeSuspend(JsonRpcInteractor.kt:271)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
In Android Studio, under External Libraries, I can only find the interface JsonRpcInteractorInterface that JsonRpcInteractor implements, but not the class itself. The class is declared as internal class, which I suppose might be the reason?
As I can't find the class, I also cannot set a breakpoint within it. Is there some trick that would enable me to still set a breakpoint in this class?
Following this I also tried to replace the dependency with a local copy where I added some print statements. But in none of the variants I tried was gradle able to find the library project.
I was able to build the full WalletConnectKotlinV2 project using ./gradlew installDebug from the repo root (it contains other components besides android-core). But haven't been able to figure out exactly where it installs what. If only I could build the library into a jar, I might be able to more easily link it into the project.
We're aware of the issue and already have PR with a possible fix. It should be included in the next release.

The base module should not have the 'split' attribute set in the AndroidManifest.xml

I want to generate bundle for my project which includes three dynamic features , and this error occured while generating bundle.
also there is no 'split' attribute in my whole porject manifest anywhere , and the project is run on debug mode, successfully. but generating bundle not working.
any suggestion is welcome.
after 3 hours searching and finding Nothing , I decided to see that when exactly this log is generated by google inside building process of bundle. and I found out that it is creating the module with name base which will be used to merge all feature modules.
and also I Myself have one feature module in my project with the name of base, I wondered if there will be any conflict with this name that occurs this issue . so I refactored and renamed my own base module to baseCore and TADA ! everything works well . finally I must say , Hey google fu.. you and your fu..ing developers with your bullsh..t system which always waste our times because of ridiculous problems and cock&bull story generated logs and hints.

Adding google maps library to existing project creates confusing error

I am building an Android app that I want to open google maps with the click of a button. I want the app to find the current location of the user and give them directions to a predefined address. I started building the application before I realized there were special steps that you have to take to include this functionality. To add this feature to my project I followed the directions on these two sites:
https://developer.android.com/google/play-services/setup.html
https://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject
The problem is on the second site, when i added the library to my already existing project it caused all of my code that has findViewById(R.id.whatever) or setContentView(R.layout.whatever) to become errors. It is now telling me that i need to import the class R. If I do that it then gives me error messages on the names of all my xml files.
For example in my MainActivity it is telling me that i should change setContentView(R.layout.activity_main) to setContentView(R.layout.activity_list_item) and does this for all references to my xml files for the entire project.
I tried going back and removing the google play services library from the project and starting over but when I removed it the errors still persists. I also tried using the "fix project setup" option in Eclipse but it didn't fix the problem.
I'm wondering if anyone here has experienced this problem before? If so, how can I fix it? The application had no errors before I tried to include the google play services library. I am new to Android development so a lot of the information I have found has been either confusing to understand or doesn't seem to include enough details for me to figure it out. Thanks for your help!
Look at your imports, and check if you are importing the correct R.java from your application package, not from the android package.
Check also if your XMLs don't contain errors, otherwise R.java won't be generated.
In my case android-maps-library had to errors in two files (I have forgotten their names), I edited the two files removing errors my self. And finally I was able to used it quite nice.
i think you have correct yout Project build target, and this how:
right click on your project folder in the package explorer->propreties->Android
then porject build target and choose you Android target (Android x.xx)
but before that you need to remove import android.R;

pubnub test application crashes: NoClassDefFound

this is a copy of my question on Pubnub support page:
Hi all, I tried running the PubnubTestApp that is downloadable with the Pubnub API from your git repo.
but when I try and start the test app i firstly get a build path error because apparently you (pubnub guys) have configured the project to look for 2 jar files that don't exist. (bcprov-jdk16-145.jar and commons-codec-1.2.jar).
after I removed those 2 references the project showed no error. but when I tried running it, it crashed again with this error:
"07-04 12:29:11.782: E/AndroidRuntime(754): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.fbt/com.fbt.PubNubTestActivity}: java.lang.ClassNotFoundException: com.fbt.PubNubTestActivity in loader dalvik.system.PathClassLoader[/data/app/com.fbt-1.apk"
after looking over the internet for the reasons for this crash, I noticed that in the manifest.xml file in the project there is a mistake in the name of the activity name. (it's named ".PubNubTestActivity" instead of ".PubnubTestActivity").
after changing the manifest, everything works and the app will install and run but there a a few problems still.
when pressing the "publish" button or the "history" button the app crashes and dies automatically. also it crashed without any clicking of anything (just like that).
here are the crash reports I got from the emulator.
http://pastie.org/private/pojnpnxmznvn9azdg7uyg
apparently the project doesn't recognize the "pubnub.crypto" jar file even though I (and you) added it to the build path and made sure it's in the project.
please let me know how to fix this so I can use (at last) pubnub in my app.
Have you tried the latest build? This should be fixed now.

Project messed up, cloned from repo now ClassNotFoundExceptions

My project got messed up so I started over by just cloning from my repo. After getting all dependencies in order, I tried running my app and it crashes from:
java.lang.RuntimeException: Unable to instantiate activity
java.lang.ClassNotFoundException: org.me.app.activities.Main in loader dalvik.system.PathClassLoader[/data/app/org.me-1.apk]
The class is there, its in the Manifest, everything is good. What can I do?! I feel like my app is burning in flames now!!
It looks like there are several possibilities that could have caused this.
Use of the android name attribute in the manifest, incorrect activity naming convention, .project file corruption, accidentally unchecking "Project -> Build Automatically": here
Incorrect (or inconsistent) package naming: here
Incorrect class loader context: here
Also you might find ideas on the Google Group thread.
Each of these has additional ideas and debugging attempts through the thread responses and comments.
If none of these work for you let us know and maybe we can find a new cause.

Categories

Resources