0

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>
Hassan Khallouf
  • 1,170
  • 1
  • 13
  • 30

2 Answers2

1
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

  1. 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.
  2. 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.
  3. 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

Community
  • 1
  • 1
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
1

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 .

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
Hassan Khallouf
  • 1,170
  • 1
  • 13
  • 30