My signed apk does not run on my mobile phone

0

I finished a small application that saves notes and I'm trying to generate the signed apk, but it does not work on my phone.

  • I have already tested generating a signed apk from a new project with just a blank activity and it worked normally on my cell phone.
  • Refined the process of generating the signed apk about 10x and none of them worked.
  • My application works normally in the emulator by Android Studio (which leaves me not understanding the problem of not working on my phone).

My little project is in github and has only 2 activity's, ie it is not complex ...

I would appreciate if someone could take a look at me ... (remembering that I've done a lot of research on the internet and tried several options). Thank you!

github project link: link

Download and try to generate the signed apk to see, I'm waiting for answers!

Editing

This project gives this error:

  

01-07 16: 35: 55,009 16335-16335 / com.lbttecnology.notes   E / AndroidRuntime: FATAL EXCEPTION: main           java.lang.RuntimeException: Unable to start activity ComponentInfo {com.lbttecnology.notes / com.lbttecnology.notes.NotesActivity}:   java.lang.IllegalStateException: Can not add header view to list -   setAdapter has already been called.                   at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2394)                   at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2446)                   at android.app.ActivityThread.access $ 600 (ActivityThread.java:165)                   at android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1373)                   at android.os.Handler.dispatchMessage (Handler.java:107)                   at android.os.Looper.loop (Looper.java:194)                   at android.app.ActivityThread.main (ActivityThread.java:5434)                   at java.lang.reflect.Method.invokeNative (Native Method)                   at java.lang.reflect.Method.invoke (Method.java:525)                   at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:834)                   at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:601)                   at dalvik.system.NativeStart.main (Native Method)            Caused by: java.lang.IllegalStateException: Can not add header view to list - setAdapter has already been called.                   at android.widget.ListView.addHeaderView (ListView.java:261)                   at android.widget.ListView.addHeaderView (ListView.java:290)                   at com.lbttecnology.notes.NotesActivity.onCreate (NotesActivity.java:53)                   at android.app.Activity.performCreate (Activity.java:5122)                   at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1146)                   at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2358)       at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2446)       at android.app.ActivityThread.access $ 600 (ActivityThread.java:165)       at android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1373)       at android.os.Handler.dispatchMessage (Handler.java:107)       at android.os.Looper.loop (Looper.java:194)       at android.app.ActivityThread.main (ActivityThread.java:5434)       at java.lang.reflect.Method.invokeNative (Native Method)       at java.lang.reflect.Method.invoke (Method.java:525)       at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:834)       at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:601)       at dalvik.system.NativeStart.main (Native Method)

    
asked by anonymous 07.01.2015 / 15:10

1 answer

0

In your code you have these two lines

setListAdapter(adapter);
getListView().addHeaderView(menu);

Where you first arrow the adapter and then add the Header, this only works this way from the Android KitKat, before it was mandatory to set the Header before setting the adapter

What should be happening to you is that the emulator is using an image of the Android KitKat or the Lollipop, where this works, whereas on your mobile phone you probably have an earlier version of Android and it does not allow that to be done.

Perhaps simply by reversing the order of these two lines solves your problem.

    
07.01.2015 / 19:21