Build unsigned APK file with Android Studio

故事扮演 提交于 2020-01-08 17:21:12

问题


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?


回答1:


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.




回答2:


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




回答3:


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




回答4:


just go to BUILD->Build APK and it's done




回答5:


Step 1 Open android studio . Build -> Generate Signed APK… . now click on “Generate Signed APK”.

Step 2

Click Create new.

Step 3

Fill the details and click ok.

jks key details,It will go back to previous window.

Click Next, and give the password which you stored in key.

Step 4

Now click Finish and wait to complete the building process.

Now apk generated successfully. Click show in Explorer.

If you need more details please visit and check the live demo http://javaant.com/how-to-make-apk-file-in-android-studio/#.VwzedZN96Hs




回答6:


In Android Studio:

  1. Build

  2. Build APK(s)

  3. Wait and go to the location shown in a pop-up window. On right bottom side




回答7:


Yes, it is possible to create an unsigned .apk with Android Studio!

Highlight the Project in your package explorer or project column, and then File - Project Structure - Artifacts - + - Android Application - From module 'your app' and then you can change the location and some other options. I enable build on make, just for ease.




回答8:


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.




回答9:


Build -> Build APK     //unsigned app


Build -> Generate Signed APK  //Signed app



回答10:


Just go to Your Application\app\build\outputs\apk

and copy both to phone and install app-debug.apk




回答11:


AndroidStudio 3.4


After Grade Build Running complete, you will see the notification at bottom-right corner like.

Click on locate and you will see your debuggable APK




回答12:


Following work for me:

Keep following setting blank if you have made in build.gradle.

signingConfigs {
        release {
            storePassword ""
            keyAlias ""
            keyPassword ""
        }
    }

and choose Gradle Task from your Editor window. It will show list of all flavor if you have created.




回答13:


--- Create new config in signingConfigs

unsigned {
        //do not sign
    }

--- Create build type in buildTypes

unsigned {
        versionNameSuffix '-unsigned'
    }

--- Go to build variants and chose unsigned standard. Build project.

--- Go to "outputs/apk" and find "XXX-unsigned.apk". To check if it is unsigned try to install it to device - you'll fail.




回答14:


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



回答15:


Android studio also create the apk file on every time compile the program, just go to your workspace folder and find app->build->outputs-> then you can see the apk file.




回答16:


You can click the dropdown near the run button on toolbar,

  1. Select "Edit Configurations"
  2. Click the "+"
  3. Select "Gradle"
  4. Choose your module as Gradle project
  5. In Tasks: enter assemble

Now press ok,

all you need to do is now select your configuration from the dropdown and press run button. It will take some time. Your unsigned apk is now located in

Project\app\build\outputs\apk



回答17:


I solve it!

First off all, you should add these:

defaultConfig { 
 multiDexEnabled true
}

dependencies {
 implementation 'com.android.support:multidex:1.0.3'
}

After, you should click Build in top bar of Android Studio:

Build > Build Bundle(s) / APK(s) > Build APK(s)

Finally, you have an app-debug.apk file in:

app > build > outputs > apk > debug > app-debug.apk

Note: apk, debug, app-debug.apk files created automatically in outputs file by Android Studio.




回答18:


Steps for creating unsigned APK

Steps for creating unsigned APK

•	Click the dropdown menu in the toolbar at the top
•	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

Note : Technically, what you want is an APK signed with a debug key. An APK that is actually unsigned will be refused by the device. So, Unsigned APK will give error if you install in device.

Note : Technically, what you want is an APK signed with a debug key. An APK that is actually unsigned will be refused by the device. So, Unsigned APK will give error if you install in device.




回答19:


For unsigned APK: Simply set signingConfig null. It will give you appName-debug-unsigned.apk

debug {
     signingConfig null
}

And build from Build menu. Enjoy

For signed APK:

signingConfigs {
        def keyProps = new Properties()
        keyProps.load(rootProject.file('keystore.properties').newDataInputStream())
        internal {
            storeFile file(keyProps.getProperty('CERTIFICATE_PATH'))
            storePassword keyProps.getProperty('STORE_PASSWORD')
            keyAlias keyProps.getProperty('KEY_ALIAS')
            keyPassword keyProps.getProperty('KEY_PASSWORD')
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.internal
            minifyEnabled false
        }
        release {
            signingConfig signingConfigs.internal
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

keystore.properties file

CERTIFICATE_PATH=./../keystore.jks
STORE_PASSWORD=password
KEY_PASSWORD=password
KEY_ALIAS=key0


来源:https://stackoverflow.com/questions/16709848/build-unsigned-apk-file-with-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!