I just built a basic Cordova image, but I can't install it on my Android phone.
It says the package is corrupted.
I have enabled "Trust unknown sources" and copied the file onto my Nexus 6P.
The build process doesn't throw any errors, it creates a android-release-unsigned.apk file as expected.
Had the same problem as you because I followed the guide I linked in the comments above; that guide is for building a release build, not a test build.
In order to build a test build, do:
cordova build android
Which should create a file called debug-build.apk
In addition, if you have an android device set up for development, you can run:
cordova run android --device
Related
When I run a configuration, I can the gradle commands android studio is running to build the apk in the build tab (assembleDebug). But it is not showing me what command is run after that to actually install the apk on a device. Is there a way I can see this?
I'm tring to build my flutter app on android in CMD and got message (in the subject) but app works properly.
The build proccess was OK and the problem started afer I changed one of the dependencies.
I have 2 flavors.
The android studio build create app without errors.
Any idea?
It's possible that the command is unable to find the build path to generate the APK. You can run these commands in the Terminal built into Android Studio.
For building APK for prod
flutter build apk --flavor prod -t lib/main_prod.dart
For building APK for dev
flutter build apk --flavor dev -t lib/main_dev.dart
I would like to get the APK file so I can install it manually rather than running through android studio.
If I search in the android directory I can see a few and the most likely is:
[project]\android\app\build\intermediates\instant-run-apk\debug\app-debug.apk
However this doesn't install properly on my device.
It works fine if I build and run through Android studio via Ionic using:
ionic capacitor run android
Do I need to do a signed production build for this to work?
In Android Studio menu Main Menu -> Build Bundle(s) / APK(s) -> Build APK(s). This then pops up a link with which you can open the file location.
Ionic 4 app apk file location as below
[project]\platforms\android\app\build\outputs\apk\debug\app_debug.apk
You have to types of builds and android studio house each build in different location:
1) Debug Build: android\app\build\outputs\apk\debug\app_debug.apk
2) Release Build: android\app\release\app.aab
We have to types of builds and android studio house each build in a different location:
1) Debug Build:
android\app\build\outputs\apk\debug\app_debug.apk
2) Release Build:
android\app\release\app.aab
You can find it after finishing your building process it will give you the location in command prompt itself just copy it and paste in the mypc quick access section it will be in top of your my pc screen..
then you will go to your apk directory.
I'm using Android Studio 2.4 preview 7 version. But, when I build debug apk and install via adb command or put apk file in sdcard of device it always gives me same error "App not installed" in any of android phone. I have got INSTALL_FAILED_TEST_ONLY error in Android Logcat every time at the time of installation in any android device.
If you analyze your apk file you'll see the problem easily - namely that when building the project with the mentioned Android Studio version, the Gradle plugin is automatically injecting an android:testOnly=true to the final AndroidManifest.xml file of the output apk.
You can read more about this property and what it's used for HERE.
To workaround this problem - you can still install the app using this command:
adb install -t debug.apk
If you want to build a signed release version of your app (e.g. for publishing the Play Store), you can always do so via Build -> Generate Signed APK. The result is an apk without the mentioned property and can be installed on any device.
If you want a bit of context why this property is injected, perhaps check THIS and THIS issues on the AOSP bug tracker.
I use Cordova 5.0.0 to develop android app and I would like to run the app on real machine.
I tried two ways to generate signed apk but failed,
One is used command line to sign an apk that generated by cordova. by this way, it will cause "parsing error" when install the apk;
The second way I tried is using android studio to generate signed apk. My step is "import non-android studio project" then generate signed apk. By this way, I install successfully but the app can't be open and popup error info "unfortunately, xx has stopped".
There is no problem with the code.
Anyone can give me some suggestion? Thanks.
Cordova 5 uses gradle to compile now, so the old ant.properties no longer works. You can work the same trick by creating a release-signing.properties file in platforms/android and adding the following:
storeFile=<path to="" .keystore="" file="">
storeType=jks
keyAlias=<your key="" alias="">
// optional :
keyPassword=<your-key-password>
storePassword=<your-store-password>
If you used Android Studio, you can try with Intellij IDEA (Android Studio is performed by Intellij Platfrom ) here.
After importing your projet, simple go to :
Build > Generate Signed APK..
You'll need to create a key and then Intellij will create your APK.
If you still have your error "unfortunaly..." connect your device and check Intellij logs.