klange klange - 3 months ago 31
Android Question

Build unsigned APK file with Android Studio

I'm developing an android app with the Android Developer Tool.
Now I tried the new Android Studio, everything works fine if connect my smartphone with the pc and directly run the program in the Android Studio.
But now I want to test the program with other smartphones without connecting them to my pc.

The ADT creates the .apk file under "projectname/bin" every time you compile the program. How I see it at the moment the Android Studio doesn't do that.

So my question is it possible to create an unsigned .apk file with Android Studio?

Answer

I would recommend you to build your apk file with gradle:

  • Click the dropdown menu in the toolbar at the top
  • Select "Edit Configurations"
  • Click the "+"
  • Select "Gradle"
  • Choose your module as Gradle project
  • In Tasks: enter assemble
  • Press Run

Your unsigned apk is now located in

ProjectName\app\build\outputs\apk

For detailed information on how to use Gradle, this tutorial is a good to go: Building with Gradle in Android Studio. I also wrote a blog post on how to build an unsigned apk with gradle.

If you moved your project from an other IDE and don't want to recompile, you may find your apk file that was already build in the IDE you moved from:

  • If you generated the Project with Android Studio, the apk file will be found in ProjectName/ProjectName/build/apk/...

  • Imported the project from eclipse: File should be in the same directory. Go to Project - Show in Explorer. There you should find the bin folder where your apk file is located in.

  • Imported from IntelliJ, the location would be ProjectName/out/production/...

Side note: As Chris Stratton mentioned in his comment:

Technically, what you want is an apk signed with a debug key. An apk that is actually unsigned will be refused by the device.