问题
As Android debug builds get reinstalled when the same phone is connected to different MacBooks, is there any way for all development machines (MacBooks) to share the same debug certificate? It will help to avoid reinstallation on development devices.
回答1:
Easiest thing to do this would be to check the debug keystore into your project and then reference it in build.gradle like so:
signingConfigs {
debug {
storeFile file('../keystore/debug.keystore')
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
release {
// ...
}
}
回答2:
I think that's possible. Android Studio automatically creates the debug keystore and certificate the first time you run or debug a project in Android Studio. Simply go to :
- ~/.android/ folder on OS X and Linux
- C:\Documents and Settings\.android\ on Windows XP
- C:\Users\.android\ on Windows Vista and Windows 7, 8, and 10
on one of your development machine and find your debug.keystore file. Copy and paste the file on the other machines at the same location. Hope it will work!
回答3:
Yes you can.
To do that, just share the certificate file located at ~.android/debug.keystore with your teammates.
回答4:
You can create your own keystore for debug builds too. On Mac, this is usually found at ~/.android folder. To create Keystore, you may do following:
- Create a
.propertiesfile with your project name(say, projectname.properties) file and store it somewhere in your project root or elsewhere. - Add following entries.
keystore=<path>\\filename.keystore keystore.password=<password> - Now we need connect
projectname.propertiesto our project. Opengradle.propertiesand add an entry.projectname.properties=<path to .properties file> We can access this properties now in
gradle.buildfile.- You can check now if a .properties file is available.
if(project.hasProperty("yourprojectname.properties") && new File(project.property("yourprojectname.properties")).exists()) { Properties propObj = new Properties() propObj.load(new FileInputStream(file(project.property("yourprojectname.properties"))) // now we have 'propObj' object to access keystore. }use this propObj to sign app for debug build.
android { signingConfigs { release { //....... } debug { keyAlias 'debug' keyPassword propObj['keystore.password'] storeFile file(propObj['keystore']) storePassword propObj['keystore.password'] } }
来源:https://stackoverflow.com/questions/54178735/sharing-android-debug-certificate-across-different-developer-machines-in-android