Reputation: 820
Below is my activity :
com.domain.app.SampleActivity.java
public class SampleActivity extends Activity {
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sample_layout);
DataProviderClass dataProvider = new DataProviderClass();
}
}
com.domain.app.anotherFolder.DataProviderClass.java
public class DataProviderClass {
private DataProviderClassHelper helper = new DataProviderClassHelper();
}
com.domain.app.anotherFolder.DataProviderClassHelper.java
public class DataProviderClassHelper implements ExternalLibInterface {
public DataProviderClassHelper() {
}
}
Below are the logs :
I/art (22555): Rejecting re-init on previously-failed class java.lang.Class I/art (22555): Rejecting re-init on previously-failed class java.lang.Class I/art (22555): Rejecting re-init on previously-failed class java.lang.Class I/art (22555): Rejecting re-init on previously-failed class java.lang.Class I/art (22555): Rejecting re-init on previously-failed class java.lang.Class E/AndroidRuntime(22555): Process: com.domain.app, PID: 22555 E/AndroidRuntime(22555): java.lang.NoClassDefFoundError: com.domain.app.anotherFolder.DataProviderClassHelper.java E/AndroidRuntime(22555): at com.domain.app.anotherFolder.DataProviderClass.java.(DataProviderClass.java:77) E/AndroidRuntime(22555): at com.domain.app.SampleActivity..onCreate(SampleActivity.java:64) W/ActivityManager( 1103): Force finishing activity 1 com.domain.app/.SampleActivity
It doesn't make sense to me one class is initialized but another class in the same folder is giving me an error.
In other similar questions people were facing this error in external libraries they were trying to import and that didn't really help me.
Upvotes: 1
Views: 81
Reputation: 820
In my DataProviderClassHelper
I was actually implementing ExternalLibInterface
interface that was provided in a stub jar of an external library.
Since it was provided
, the code would compile successfully but that actual thing was not available to me at runtime. To be able to access the actual thing on the system I had to add some library specific component in my AndroidManifest.xml
. So the solution might not exactly help everyone but it will help people identify the cause of the issue.
In my case it was due to unavailability of ExternalLibInterface
at runtime.
Upvotes: 2