Project migration done in Eclipse to Android Studio - FATAL EXCEPTION

Asked

Viewed 29 times

1

I made the import and I had no mistake, more when I try to compile the project I have this problem:

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

07-13 15:29:13.786 1380-1380/br.com.sistemaguardiao E/AndroidRuntime: FATAL EXCEPTION: main
                                                                  java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.sistemaguardiao/main.Main}: java.lang.NullPointerException
                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
                                                                      at android.app.ActivityThread.access$600(ActivityThread.java:130)
                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
                                                                      at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                      at android.os.Looper.loop(Looper.java:137)
                                                                      at android.app.ActivityThread.main(ActivityThread.java:4745)
                                                                      at java.lang.reflect.Method.invokeNative(Native Method)
                                                                      at java.lang.reflect.Method.invoke(Method.java:511)
                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                                                                      at dalvik.system.NativeStart.main(Native Method)
                                                                   Caused by: java.lang.NullPointerException
                                                                      at main.Main.onCreate(Main.java:47)
                                                                      at android.app.Activity.performCreate(Activity.java:5008)
                                                                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
                                                                      at android.app.ActivityThread.access$600(ActivityThread.java:130) 
                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
                                                                      at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                      at android.os.Looper.loop(Looper.java:137) 
                                                                      at android.app.ActivityThread.main(ActivityThread.java:4745) 
                                                                      at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                      at java.lang.reflect.Method.invoke(Method.java:511) 
                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
                                                                      at dalvik.system.NativeStart.main(Native Method) 
  • It’s probably because we’re missing some essential files from an Android project, like Androidmanifest which declares all of the project’s activities. How do you take a shot of your project folder?

  • 1

    Open the terminal in Android Studio and run this command gradlew -d assembleDebug it will "debug" the build, sometimes corrects some import mistakes

  • @Memphys, I added the images, thank you if you can help me, I’m really in need of help right now

  • @Lucasqueirozribeiro, I’m doing it right now, I have the answer, I have a hole in my stomach! :-)

  • I would do what @Lucasqueirozribeiro suggested. Try to do the project Sync with Gradle as well. I’m without the IDE now but if I’m not mistaken it’s project > Sync project.

  • @Memphys, I did, now shows me a manifest error, at this point android:name="main.Devicelistactivity" the others shows no error

  • From what I’m seeing inside your project folder, there’s no class named Devicelistactivity. Androidmanifest.xml is trying to find this class inside the main package and can’t because it doesn’t exist.

  • Sometimes the class got into a wrong folder or another package, edits its manifest ,deletes that error-giving Activity and starts typing again, the IDE should suggest the right file (probably without the main, only .DeviceListActivity)

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.