Build unsigned APK file with Android Studio

前端 未结 19 2976
抹茶落季
抹茶落季 2020-11-28 00:15

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 r

相关标签:
19条回答
  • 2020-11-28 00:51

    I would recommend you to build your APK file with Gradle:

    • Click the dropdown menu in the toolbar at the top (Open 'Edit Run/Debug configurations' dialog)
    • Select "Edit Configurations"
    • Click the "+"
    • Select "Gradle"
    • Choose your module as a 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 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 the other IDE and don't want to recompile, you may find your APK file that was already built 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.

    0 讨论(0)
  • 2020-11-28 00:51

    Now in Android Studio v1.1.0 should be:

    1. select Run > Run <your app>
    2. find .apk file in <your app>\build\outputs\apk
    0 讨论(0)
  • 2020-11-28 00:52

    The easiest way, I guess:

    • Open Gradle tab on the right side
    • Double click YourProject/:app/assemble (or assembleDebug)
    • You'll find the apk here
      .../YourProject/app/build/outputs/apk/app-debug.apk

    screenshot

    0 讨论(0)
  • 2020-11-28 00:52

    With Android Studio 2.2.3 on OSX I just used the top menu:

    Build > Build APK
    

    It opened Finder with the .apk file. This won't generate a signed APK. You can select Generate Signed APK from the same menu if needed.

    0 讨论(0)
  • 2020-11-28 00:59

    According to Build Unsigned APK with Gradle you can simply build your application with gradle. In order to do that:

    1. click on the drop down menu on the toolbar at the top (usually with android icon and name of your application)
    2. select Edit configurations
    3. click plus sign at top left corner or press alt+insert
    4. select Gradle
    5. choose your module as Gradle project
    6. in Tasks: enter assemble
    7. press OK
    8. press play

    After that you should find your unsigned 'apk' in directory ProjectName\app\build\outputs\apk

    0 讨论(0)
  • 2020-11-28 00:59
    Build -> Build APK     //unsigned app
    
    
    Build -> Generate Signed APK  //Signed app
    
    0 讨论(0)
提交回复
热议问题