0

The problem that i have it's that when i try to run the app in a device works well and the code builds well but when the apk is installed, then close because say that didn't works well. And in the part of android run time, apears the message.

I try to download versions or something similar but don't work well.

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.myapplication1, PID: 5245
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.myapplication1/com.example.myapplication1.MapsActivity}: java.lang.InstantiationException: java.lang.Class<com.example.myapplication1.MapsActivity> has no zero argument constructor
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2850)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3059)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1724)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:7000)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
     Caused by: java.lang.InstantiationException: java.lang.Class<com.example.myapplication1.MapsActivity> has no zero argument constructor
        at java.lang.Class.newInstance(Native Method)
        at android.app.Instrumentation.newActivity(Instrumentation.java:1182)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2840)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3059) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1724) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:7000) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

what i have to do? Thanks for trying and helping.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
ignasi
  • 1
  • 2
    `Caused by: java.lang.InstantiationException: java.lang.Class has no zero argument constructor` Tells you that it wants a constructor signature with no arguments. – Phantômaxx Aug 06 '19 at 17:43
  • 2
    In addition to the previous commenter- an Activity should only be instantiated by the framework, so it should never have any constructor other than the 0 args constructor. – Gabe Sechan Aug 06 '19 at 17:51
  • Thanks for the answers, but how i put the constructor signature with no arguments? @Fantômas. – ignasi Aug 08 '19 at 18:06
  • thanks, but where can't have any constructor other than the 0 args constructor? @GabeSechan – ignasi Aug 08 '19 at 18:07
  • 1
    @ignasi The Activity. Any Activity. Only the framework itself should ever instantiate an Activity, and it only uses the default constructor. – Gabe Sechan Aug 08 '19 at 18:08

0 Answers0