How to test signed application (apk) on the Hardware Devices?
I am doing now the following:
- Export application from Eclipse
- Change device connection type to USB
- Manually copy it to the device
- Change device connection type to Sync
- Manually install that on开发者_JS百科 device
Is there any way to create Eclipse Debug configuration (or something else) to do it automatically?
I need to test that on device and file should be signed since I am testing in-app purchases functionality.
You can use ant for building, it will automate the whole builds process (for release as well).
The default configuration contains an install target as well, but I believe this installs the debug apk.
EDIT: you can install an apk via adb:
adb install <apk>
For the first part of the question:
http://developer.android.com/guide/developing/building/building-eclipse.html
Automatic and manual target modes
By default, a run configuration uses the automatic target mode in order to select an AVD. In this mode, ADT will select an AVD for the application in the following manner:
1) If there's a device or emulator already running and its AVD configuration meets the requirements of the application's build target, the application is installed and run upon it.
2) If there's more than one device or emulator running, each of which meets the requirements of the build target, a "device chooser" is shown to let you select which device to use.
3) If there are no devices or emulators running that meet the requirements of the build target, ADT looks at the available AVDs. If there is an AVD that matches the build target of the project, ADT chooses that AVD. If the AVD versions are newer than the build target of the project, ADT chooses the oldest possible version of an AVD that meets the project's build target requirement.
4) If there are no suitable AVDs, the application is not installed a console error warning tells you that there is no existing AVD that meets the build target requirements.
However, if a "preferred AVD" is selected in the run configuration, then the application will always be deployed to that AVD. If it's not already running, then a new emulator will be launched.
If your run configuration uses manual mode, then the "device chooser" is presented every time that your application is run, so that you can select which AVD to use.
And for the second part,
http://developer.android.com/guide/publishing/app-signing.html#ExportWizard
Compile and sign with Eclipse ADT
If you are using Eclipse with the ADT plugin, you can use the Export Wizard to export a signed .apk (and even create a new keystore, if necessary). The Export Wizard performs all the interaction with the Keytool and Jarsigner for you, which allows you to sign the package using a GUI instead of performing the manual procedures to compile, sign, and align, as discussed above. Once the wizard has compiled and signed your package, it will also perfom package alignment with zipalign. Because the Export Wizard uses both Keytool and Jarsigner, you should ensure that they are accessible on your computer, as described above in the Basic Setup for Signing.
To create a signed and aligned .apk in Eclipse:
1) Select the project in the Package Explorer and select File > Export.
2)Open the Android folder, select Export Android Application, and click Next.
3) The Export Android Application wizard now starts, which will guide you through the process of signing your application, including steps for selecting the private key with which to sign the .apk (or creating a new keystore and private key). Complete the Export Wizard and your application will be compiled, signed, aligned, and ready for distribution.
If all this is not enough, then the option is building it with ant. See here for some ideas (as I said in the comment, I have no experience with it):
http://developer.android.com/guide/developing/projects/projects-cmdline.html
Eclipse Android app: Run signed with real certificate
Android Ant project reference
http://www.alittlemadness.com/2010/05/31/setting-up-an-android-project-build/
精彩评论