java - Disappearing default constructors -
I have received several crash reports with the following stack trace (name change):
Reason by: java.lang.InstantiationException: Class can not start com.example. My application; No empty creator on java.lang.Class.newInstance (Class.java12319) on android.app at android.app on Java.lang.Clang.newInstanceImpl (Basic Method) android.app.Instrumentation.newApplication (Instrumentation.java:997) . Instrumentation.newApplication (Instrumentation.java:982) ... 11 and java.lang.RuntimeException on Android.app.LoadedApk.makeApplication (LoadedApk.java:496): Unable to instantiate the application com.example. MyApplication: java.lang InstantiationException: Class can not start com.example. MyApplication; There is no empty manufacturer on Android.app.LoadedApk.makeApplication (LoadedApk.java .0101)
android.app.Application
is a manufacturer with a clear parameter :
public application () {super (blank); }
MyApplication
inherited from android.app.Application
and no explicit constructor at all is. According to my understanding of Java Speak, it means that interconnected should be inserted by the following manufacturer compiler:
Public MyApplication () {super (); }
This may have happened, or I have never been able to compile the app for the first time. So what could be the reason for these accidents?
Edit: Here is part of the output from Decompelling ProGuard-ed
MyApplication.class
javap
: "MyApplication.java" compiled public class com.example. My Exceptions Android.app.app {public com.example.MyApplication (); Signature: () Creates (V) on Public Zero; Signature: () Vocal vacuum (); Signature: () V public void zero (integer); Signature: (i) v // ... some other methods ... stable {}; Signature: () V}
The default constructor is definitely there, and it is public.
Note: this issue did not come out in this case, but if you are reading this question Because you have encountered the same symptom, it can be a problem for you ...
According to my understanding of Java Spec , It means that the following constructor should be implied by the compiler
Public MyApplication () {super}; }
This is only the case if it is from the public class:
the default constructor's orbit (§ 6.6) has the same access as.
So if your class is declared public
, the constructor will not be public either.
You have not shown your class declaration, but first you should see that it is public.
Comments
Post a Comment