-2

I have received *.apk file developed in Android Studio by a friend of mine. This app works fine on his Emulator and on his phone, but not on mine (Samsung Galaxy S4). I get "Unfortunately app has stopped" on my phone.

I can't put any code here because it is a huge application and there is no error reported in Android Studio. I was thinking that it might be a problem with the version that was set in the "New Project" page, but there it was shown that the selected version works for 100% of the phones.

I have also checked these methods, but with no success.

So the only thing that comes to mind right now is that it is something to do with development options and permissions in the Android OS, but I don't know which option should I play with.

Now the question is... is there anyone who can help me with this crash? I know it is a very loose question, but I hope that there are people who dealt with this here.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Physther
  • 246
  • 3
  • 10
  • If you received an .apk file and installed it then you have no code. So what are you talking about code? – greenapps Nov 16 '17 at 12:44
  • The code developed by him has no error. And yes, I only have the *.apk that I can work on. – Physther Nov 16 '17 at 12:46
  • 2
    I do not understand how Android Studio comes in play if you only have an .apk file and installed it on your phone. `I get "Unfortunately app has stopped (Android Studio)"` ????? And later you tell us: `and there is no error reported in Android Studio. ` . Now what is going on? – greenapps Nov 16 '17 at 12:48
  • Thank you for the observation @greenapps. I have edited the questions. I hope it makes more sense now. – Physther Nov 16 '17 at 13:00
  • Thank you, @VladMatvienko. That discussion might help me if I could get a log of error. Is it possible to find a log for the app crash on an Android phone? – Physther Nov 16 '17 at 13:08
  • 1
    how about searching it? – Vladyslav Matviienko Nov 16 '17 at 13:10
  • Let your friend delete the app from its phone and then let him install the .apk file like you did without Android Studio. – greenapps Nov 16 '17 at 13:13
  • If it is a coding problem then lend him your S4 for a while. ;-). – greenapps Nov 16 '17 at 13:14
  • `I hope it makes more sense now` Not enough. `I can't put any code here because it is a huge application`. You do not have the code. So why talking about code? Makes no sense. `and there is no error reported in Android Studio.` No. Why would it? – greenapps Nov 16 '17 at 13:25

1 Answers1

1

I had the same problem when I sent my friend apk file directly from my device through shareit after I run it. The app will just close because the APK is generated and installed on debug mode, so it will only run on device that is connected to android studio. Ask your friend to send .apk file that is generated from Build> Build APK. There should be no problem, If that did not work ask him to send from "Generate Signed APK" option.

kiran goud
  • 803
  • 2
  • 10
  • 17
  • Why are you not mentioning that this is only necessary when Android Studio 3.0 is used? And why not telling a bit about the reason? – greenapps Nov 16 '17 at 12:51
  • I have edited the answer, added explanation. This issue existed in older versions of Android studio also that's why I haven't mentioned anything about it. – kiran goud Nov 16 '17 at 13:02
  • Thank you Kiran, That's the *.apk I have. The one generated using the "Build" option. I will ask for "Generated Signed APK", and see if there is any difference. Also, do you know if the "Release" option in Android Studio will cancel the "Debug" mode in "Build Variants"? – Physther Nov 16 '17 at 13:02
  • `The app will just close because the APK is generated and installed on debug mode`. No. That is not the reason. And you did not mention 3.0. – greenapps Nov 16 '17 at 13:02
  • Android Studio 3.0 `android:testOnly="true"` Read a blog entry of CommonsWare: https://commonsware.com/blog/2017/10/31/android-studio-3p0-flag-test-only.html – greenapps Nov 16 '17 at 13:09
  • @Physther you can try changing the build variants from Build > Select build variant... – kiran goud Nov 16 '17 at 13:15
  • Think that what i said about `testOnly` is wrong as then the apk cannot even be installed. – greenapps Nov 16 '17 at 13:22
  • We have tried with Signature and with Release instead of debug. Still the same problem. However, I have noticed that when the code behind the *.apk is without permissions, there is no error. Once the permissions are added in the code... CRASH. Any ideas ? – Physther Nov 16 '17 at 20:20