Modified Android Studio Project name

Asked

Viewed 47 times

0

I changed the name of the project using Refactor - Rename, but when copying this error:

Logcat:

04-18 06:40:04.480 19491-19491/? D/dalvikvm: Late-enabling CheckJNI
04-18 06:40:04.680 19491-19491/com.example.jeferson.Vote25 D/AndroidRuntime: Shutting down VM
04-18 06:40:04.680 19491-19491/com.example.jeferson.Vote25 W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x64cbcb20)
04-18 06:40:04.680 19491-19491/com.example.jeferson.Vote25 D/AndroidRuntime: procName from cmdline: com.example.jeferson.Vote25
04-18 06:40:04.680 19491-19491/com.example.jeferson.Vote25 E/AndroidRuntime: in writeCrashedAppName, pkgName :com.example.jeferson.Vote25
04-18 06:40:04.690 19491-19491/com.example.jeferson.Vote25 D/AndroidRuntime: file written successfully with content: com.example.jeferson.Vote25 StringBuffer : ;com.example.jeferson.Vote25
04-18 06:40:04.800 19491-19491/? I/Process: Sending signal. PID: 19491 SIG: 9
04-18 06:40:04.800 19491-19491/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.jeferson.Vote25, PID: 19491
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.jeferson.Vote25/com.example.jeferson.Vote25.MainActivity}: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5021)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button
at com.example.jeferson.Vote25.MainActivity.onCreate(MainActivity.java:28)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
at android.app.ActivityThread.access$800(ActivityThread.java:135) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5021) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643) 
at dalvik.system.NativeStart.main(Native Method) 
  • The problem seems to be xml value recovery error, trying to force a cast from imagebutton to button. post your xml and your Activity so we can help you better.

  • Really Geferson problem I declared Imagebutton in xml already in . java Button.. Thank you

  • That being the case, I will answer the question to state the solution.

  • Thanks again..

1 answer

0


The problem lies in that line:

Caused by: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button

Declared a component in xml(view) and retrieved otherwise in Activity.

Browser other questions tagged

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