I'm creating a kind of complex app that has multiple dependencies, I was using newrelic for a while with no problems, after that I wanted to add ZenDesk to the app, but when initializing the SDK , I was receiving a new relic error which was too weird! I tried for the sake of testing to remove newrelic from the app completely, so I removed compile 'com.newrelic.agent.android:android-agent:5.3.1' from the gradle file
the app doesn't work at all now! it crashes on start showing the error in the title:
java.lang.ClassNotFoundException: Didn't find class *.*.MainActivity
when I add the newrelic back the app starts to work again!
I tried to to some digging about the problem and I found few suggestions about stopping gradle and cleaning the project and so saying the problem is probably a gradle cash or so, I tried everything, I even tried it on another machine, the problem persisted !
any ideas what is wrong??
EDIT:
manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:supportsRtl="true">
<activity
android:name="com.myapp.Main.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
</application>
</manifest>
android:name="com.myapp.Main.MainActivity"
I guess it is wrong
It will
android:name="com.orderme.MainActivity"
The ClassNotFoundException is thrown when the Java Virtual Machine
(JVM) tries to load a particular class and the specified class cannot
be found in the classpath. The ClassNotFoundException is a checked
exception and thus, must be declared in a method or constructor’s
throws clause.
What is the way
Verify that the name of the requested class is correct and that the
appropriate .jar file exists in your classpath. If not, you must
explicitly add it to your application’s classpath.
In case the specified .jar file exists in your classpath then, your
application’s classpath is getting overriden and you must find the
exact classpath used by your application.
In case the exception is caused by a third party class, you must
identify the class that throws the exception and then, add the
missing .jar files in your classpath.
Eclipse - java.lang.ClassNotFoundException
As always, the solution is 99% stupid when it comes to programming XD
at the top of my gradle file there was this:
apply plugin: 'newrelic'
I just removed this line and it works now .
Related
I am working in Android 2.3.3, and have run into this error: "Tag manifest attribute package has invalid character'_'. Initially, I was getting this error because my package name contained an underscore (com.isco_pipe.www.fieldtechapp). I have since renamed the package and removed the underscore (as you can see in the manifest file below). But the error persists upon an attempt to rebuild. Any thoughts?
Here is my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.iscopipe.www.fieldtechapp">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application android:allowBackup="true" android:icon="#mipmap/ic_launcher"
android:label="#string/app_name" android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true" android:theme="#style/AppTheme">
<activity android:name="com.iscopipe.www.fieldtechapp.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Note: I previously asked a question about not being able to debug my app on my device (running Android Studio on a virtual machine). I am now attempting to setup and run my app in Android Studio directly on my Windows laptop to see if I can run the app on an emulator and debug from there. Unable to attach debugger to Android process in Android Studio 2.3.3
Check your build.gradle file also, what you gave in applicationId.
Make sure that you are editing the proper file. Android Studio has the absolutely aggravating "feature" where certain errors cause a file in build/ to pop up in the editor. In your case, it would be a merged manifest, not your actual manifest. Editing files in build/ will have no effect, as they get re-created on each build. So, make sure that you have modified your actual manifest (e.g., src/main/AndroidManifest.xml).
I seem to be having a similar problem to a myriad of the community; however, I don't seem to have the same symptoms (or at the very least, my Google-fu is not allowing me to find it).
Long story short: The app is giving me java.lang.RuntimeException: Unable to instantiate activity.
From what I understand this can only be caused by improper order of loading libraries or by missing the file in the AndroidManifest.xml.
Here is my AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.alexanderlyons.livingpokedex">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Here is a link to my repository for those wanting to build it themselves. If anyone can give me insight as to what might be wrong.
Note: This may be due to my .gitignore, as the last time I built, it was on my main tower. I am only running into this issue on a remote machine.
TL:DR - My MainActivity is not loading, it exists in the AndriodManifest.xml, and I am only using gradles to load files, not local jars.
Your problem can be caused by different things, but the most common of it is you having too many libraries loaded, with too many methods.
You should enable multidex in your app, here's the guide:
multidex
A quick tutorial:
Add "multiDexEnabled true" to your gradle config (under target sdk version, for example).
Add this to your dependencies:
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
And make sure you application extends this:
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
Either via code or via manifest.
Edit:
Test the project with the build tools 22, sd version 22 and target 22. Also, use the support libraries 22.+
I've been following this tutorial to create an android game. I downloaded the skeleton he provided but changed one of my packages from robotgame to highst. Whenever I try and deploy the application with the example code to my device I get the following error.
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.ronyo.robotgame/com.ronyo.highst.Loader }
Error type 3
Error: Activity class {com.ronyo.robotgame/com.ronyo.highst.Loader} does not exist.
I've searched for an instance of robotgame in my project and I can't find an instance of it. The tutorial above is created using Eclipse and I'm porting it to Android Studio. I'm wondering if I've overlooked something when switching IDEs?
Here is my AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ronyo.highst"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:icon="#drawable/icon"
android:label="Loader" >
<activity
android:name=".Loader"
android:configChanges="keyboard|keyboardHidden|orientation"
android:label="Loader"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.inten.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Delete the folders .idea and .gradle then click button "Sync project with gradle files"
It looks like the package wasn't updated everywhere. Have you changed anything in the manifest?
In the AndroidManifest.xml file, in the <manifest tag, there should be a package attribute. That needs to be updated to match your new package name, com.ronyo.highst.
Check out the documentation here: http://developer.android.com/guide/topics/manifest/manifest-element.html
don't change it directly , It'll not update all the references, use this
right click on project > Android tools > Rename application package
I'm tying to publish my app on the market. But after i sign my apk and install it i get a crash before it even loads an activity. I've located the following error in the logCat
03-24 14:57:03.080: E/AndroidRuntime(4310): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.golfboxdk/com.golfboxdk.LoginActivity}:
java.lang.ClassNotFoundException: Didn't find class "com.golfboxdk.LoginActivity" on path: DexPathList[[zip file "/data/app/com.golfboxdk-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.golfboxdk-1, /vendor/lib, /system/lib]]
I've checked my manifest and i really cant figure out whats wrong. My app runs smoothly when I'm using an unsigned apk.
This is the start of my manifest
package="com.golfboxdk"
android:versionCode="5"
android:versionName="1.7.2" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:name="com.golfboxdk.utils.GolfBoxApplication"
android:allowBackup="false"
android:icon="#drawable/app_icon"
android:killAfterRestore="true"
android:label="#string/app_name"
android:theme="#android:style/Theme.Light.NoTitleBar" >
<activity
android:name="com.golfboxdk.LoginActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Things i already tried:
Enabling all files under ->Project->Properties->java Build path->Order and Expert, followed with a clean.
Check if ProGuard is activated (it's not)
Try the following:
Project > Uncheck build automatically
Clean the workspace
Manually build your project
Sign your apk and send it to device via bluetooth/wifi/email, etc.
Test it and release it if it works
I have had this issue before with Eclipse/ADT. Sometimes it just doesn't seem to package up the APK correctly.
Typically a clean and build followed by exporting the signed APK again fixes it for me.
No one said that there would be a problem with proguard, but only this solved my issue.
I went through all the articles about the INSTALL_FAILED_MISSING_SHARED_LIBRARY issue in Google Maps projects but I couldn't find a case similar to mine nor a solution, so here is my problem:
I have a project with an activity (com.example.googleMaps.AndroidGoogleMapsActivity) that inherits from MapView to show a Google Map and do some stuff.
I run it on a Samsung Galaxy S II and it works fine: it shows the map and does the stuff it is supposed to do.
Now.
I want to use this project as a library for another project and show that activity as the first screen of another app.
So I checked the box Is Library, I created a new android project that builds against GoogleAPI and includes the library in the Android properties in Eclipse with the following manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="test.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk android:minSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<uses-library android:name="com.example.googleMaps" required="true" />
<uses-library android:name="com.google.android.maps" required="true" />
<activity android:name="com.example.googleMaps.AndroidGoogleMapsActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I run this new project on my device and I get the infamous error:
INSTALL_FAILED_MISSING_SHARED_LIBRARY
and LogCat is totally silent.
I would like to point out that the activity inside the library works so none of the well know issues should apply.
In the client project I specify two uses-library tags (one for my library and one for the Google library), I build against GoogleAPI, include the library in the Android properties in Eclipse and run on a tested device.
Am I still missing something?
I had the same problem, just remove the line:
<uses-library android:name="com.example.googleMaps" required="true" />
and it should work.
Only Use com.google.android.maps. Please remove another one.