Ionic and Crosswalk Can’t Generate Signed APK - ionic-framework

I am trying to add crosswalk to my ionic. My apps are launched and working fine. However after I added Crosswalk, I can't generate signed apks anymore. I tried to remove crosswalk and it works again. How did you guys manage to get it working?
Here's what I did:
cordova plugin add cordova-plugin-crosswalk-webview
cordova platform add android
ionic build android
it builds fine except:
BUILD SUCCESSFUL
Total time: 1 mins 34.909 secs
Built the following apk(s):
<--- this part is empty, usually it'll show the path of the apk generated
In Android Studio I get this error for the gradle sync.
NDK integration is deprecated in the current plugin.
When I try to generate signed apk, I get this error:
Missing Gradle Project Information. Please check if the IDE successfully synchronized its state with the Gradle Project Model.
I tried cordova platform add android#4.1, instead of using latest one. And I was able to build it with sdk 22.
However when I try to publish, I'm getting this problem.
It is forbidden to downgrade devices which previously used M permissions (target SDK 23 and above) to APKs which use old style permissions (target SDK 22 and below). This occurs in the change from version 103098 (target SDK 23) to version 104004 (target SDK 22).

The steps I followed to get signed apk is as-
open terminal and go to android file
$ cd projectDir/platforms/android
and run this command to generate digital signature
$ keytool -genkey -v -keystore exampleapp.keystore -alias example -keyalg RSA -keysize 2048 -validity 10000
# This will create a file in you "projectDir/platforms/android" directory with a name of exampleapp.keystore which will have digital signature.
# Now Create a file with name of release-signing.properties here in
projectDir/platforms/android directory.
# Provide details to this file about your signature.
*# signed apk details
storeFile=exampleapp.keystore
keyAlias=mindfull
storePassword=password
keyPassword=password*
Go to terminal and exit to main project directory by typing
$ cd ../..
Run this command to build signed apk.
$ cordova build android --release
this will run many task and show something like this-
Now you can upload this apk on play store and share with your friend.
Have a nice day !!!
For more you can see here
https://randvblog.wordpress.com/2016/07/04/generate-signed-apk-for-android-using-gradle-for-cordova-6-0-0-in-ionic/

Related

Flutter Google SignIn Error after build apk

Flutter app works appropriately in emulator but after build app is not working:
Add SHA certificate fingerprints in your firebase project
by following steps:
Step 1
Make Sure You have java installed in your system
Step 2
Run the following command
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore"
enter password:
android

Flutter Project: Getting Kotlin Related Errors When Generating Signed APK in Android Studio

I am able to build an unsigned APK using flutter build apk --split-per-abi --no-tree-shake-icons. However, when I attempt to generate a signed APK, I get several Kotlin related errors. To be clear, I can build the project without signing just fine. However, when I attempt to generate a signing key (via Android Studio) the process fails with the errors shown below. I believe the signing process uses 'tools.jar' which is available in JDK 8. I have added JDK 8 (liberica-1.8) to the project structure. I've seen some postings indicating openjdk#8 is not compatible with M1 Macs. The JDK 8 included with Android Studio, however, indicates that it supports aarch64 so I assume this isn't a problem. Nevertheless, I cannot determine the source of these errors.
MainActivity.kt:
I'm using the APK key generation process in Android Studio to sign my APK (Build > Generate Signed Bundle / APK):
I am not attempting to run ProGuard at this time:
I am running on Apple silicon. I've tried flutter clean and invalidating caches.
After further investigation and testing, I believe the bundle and APK signing process that's built into Android Studio (Bumblebee 2021.1.1) will not work on a M1 Mac. I tested this process using a variety of JDKs. Each time, I get the same errors I shared earlier (JDK 8 must be used to avoid a missing tools.jar problem). I strongly suspect (but have not yet tested) that this same signing process works fine on Intel Macs.
As a workaround for M1 Macs, I am posting a comprehensive solution found here that is derived from posts by RichardC and Kit.
(A) To generate the keystore:
keytool -genkey -v -keystore ~/Desktop/upload-keystore.keystore -alias upload -keyalg RSA -keysize 2048 -validity 10000
(B) To sign an APK:
jarsigner -verbose -keystore ~/Desktop/upload-keystore.keystore ~/Desktop/app-armeabi-v7a-release.apk upload
(C) If the above command fails, try this one (SDK must be at least 1.7):
jarsigner -verbose -digestalg SHA1 -sigalg MD5withRSA -keystore ~/Desktop/upload-keystore.keystore ~/Desktop/app-armeabi-v7a-release.apk upload
(D) To zip align an APK:
~/Library/Android/sdk/build-tools/32.0.0/zipalign -f -v 4 ~/Desktop/app-armeabi-v7a-release.apk ~/Desktop/app-armeabi-v7a-release-za.apk
NOTE: make sure to check/replace 32.0.0 as needed.
(E) If the APK file is already signed, remove the original sign with following code:
Zip -d ~/Desktop/app-armeabi-v7a-release.apk META-INF/*
I was able to sign the APKs I built with Flutter flutter build apk --split-per-abi --no-tree-shake-icons using these CLI commands with no issues on my M1 Mac. Hopefully a future release of Android Studio corrects this issue.

how to resolve installation problem in device ionic 4

I'm trying install .APK in my divece but I get the following error "app was not installed", I'm using ionic v 4 and my divece is android 6.0.1, any idea ?
Use this command for V4 :
ionic cordova build --release android
This will generate unsigned apk file under
platforms/android/build/outputs/apk/your-project-name.apk
And simply download apk file to your phone and install it. More details can be found here
I faced this error before and the cause was that using unsigned APK or the device contains app with same "App Id"
So to Solve it, Please Follow this instructions:
Use this Command
ionic cordova build android --prod
Then Try to remove any other apps from your phone that may have same app id (any old versions or sample apps) or change your app id from config.xml (before build of course)
<widget id="com.android.YOUR_UNIQE_APP_ID" ... >

How to get .apk and .ipa file from flutter?

I am new to flutter programming and I've created a demo app, its running fine on both android and iOS devices. I want to see .apk and .ipa file in flutter. Can anyone help me to get these files from Flutter? Where can I see these files in folders or is there any other solution.
For apk (Android) you need to run the command :
flutter build apk --release
If you want to split the apks per abi (Split Apk) then run
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
For ipa (iOS) you need to run the command :
flutter build ios --release
From the console
P.S. --release is optional as it is by default
if you need debug build, just replace --release with --debug
you can find the released APK or IPA files form
build/app/outputs/flutter-apk/app-release.apk
For Android an APK is generated every time you build the app, e.g. with flutter run. You will find that in your project folder under <project>/build/app/outputs/apk/debug/app-debug.apk. If you want a release APK, have a look at the docs.
I'm not an iOS person, so I'm not sure an IPA is generated during development as in android. But looking at these docs it seems you can follow the standard steps on xcode to get it, as shown here.
For apk (Android) run the command :
flutter build apk --release
For ipa (iOS) run the command :
flutter build ios --release
Then to get actual .ipa file, open xcode -> Product -> archive -> Distribute App -> Ad Hoc -> Export
You can then save the .ipa(which is inside the Runner folder) file in any location
I also had this question and had a really tough time finding the right solution.
First of all in the terminal of your code editor type:
flutter build apk --release
and after that go to this location:
yourAppFolder/build/app/outputs/apk/release/app-release.apk
I do not do development for iOS so I don't know much about that.
For Android, an APK is generated every time you build the app, e.g. with flutter run. You will find that in your project folder under <project>/build/app/outputs/apk/debug/app-debug.apk.
Follow below steps to get .apk and .ipa from flutter app in Mac system
First, Enter below command in your terminal to go your project directory
cd $(PROJECT FOLDER PATH)
For android apk build to upload store, Enter below command
sudo $(FLUTTER SDK PATH till bin)/flutter build apk --release
To get ios ipa , Enter below command
sudo $(FLUTTER SDK PATH till bin)/flutter build ios --release
To get an apk, it is simple. Just use :
flutter build apk
To get an ipa, It is more complicated. First use :
flutter build ipa
Be careful to use flutter build ipa, not flutter build ios, because the second one builds a ".app" file instead of ".xcarchives" file.
Once you have the ".xcarchives" file, you can open it in XCode and click on "Distribute the app" to export an ipa file on your computer.
For iOS:
Step 1: open terminal and type cd "your flutter sdk path"
Step 2: cd export PATH=/Users/yourname/Downloads/flutter/bin:$PATH
Step 3: cd your project path
Step 4: flutter build ios --release
run step 1 to 4 in terminal.
After that open android studio and go to iOS folder path and open project.pbxproj file with ios module and in xcode you need to choose generic ios device and select archive, it will generate ipa build for you.
Android(After adding release build type run below command which will generate release apk with below version)
flutter build apk --build-name=1.0.1 --build-number=1
iOS
flutter build ios --release
For a detail explanation read the below article.
https://medium.com/#ralphbergmann/versioning-with-flutter-299869e68af4
For apk, you can use flutter build apk --release to get the release version of your apk on either windows/macOS.
For ipa, you have to use flutter build ios --release to get the release version of your apk on macOS.
Note: You can get a ipa on macOS only.
If you want this apk and .ipa with flavour then you can refer below commands for internal and production.
iOS:
flutter build ios --debug --flavor internal
flutter build ios --release --flavor production
android:
flutter build apk --debug --flavor internal
flutter build apk --release --flavor production
Updated for iOS :-
first you need to go to your current working directory and run the following command;
flutter build ios --release
After successfully completion of build, you can find build on below path;
/Users/sanjaybalaji/Documents/KiranFlutterApps/hb_calculator/build/ios/iphoneos/Runn
er.app.
you can check below screenshots for more details.
You can find your app apk after you run the app at path
<project_dir>/build/app/outputs/flutter-apk/app.apk

Resigning my app with the same keystore failed

Salam all,
I've created an app for android 2.2 using Eclipse and I have signed using a keystore that I have created, then I have upload it to the Market.
I have done some changes on the app, I have changed the app version from 1.0 tp 1.1, then I have tried to sign the new generated .apk file but I've got the following error:
jarsigner: unable to sign jar: java.util.zip.ZipException: invalid entry compressed size (expected 525 but got 527 bytes).
This error occurs when you try to sing a signed .apk file, I have generated an unsigned .apk from Eclipse and my app signed successfuly.
Now the Market refuses my new signed app, I guess that the first version was signed by Eclpise and my keystore, now I cannot have a new version signed by both. is this true analysis?
What am I doing wrong?
To get an unsigned apk in Eclipse, right click on application name in the Package Explorer window and choose Android Tools, then choose "Export Unsigned Application Package...". Save the package to a new location.
Once you have an unsigned apk. Run the jarsigner command you were using on the unsigned apk file.
$ jarsigner -verbose -keystore my-release-key.keystore my_application.apk alias_name
$ jarsigner -verify my_signed.apk
$ jarsigner -verify -verbose -certs my_application.apk
Note: If you see "CN=Android Debug", this means the .apk was signed with the debug key generated by the Android SDK. If you intend to release your application, you must sign it with your private key instead of the debug key.
$ zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk
$ zipalign -c -v <alignment> existing.apk
Source:
http://forum.xda-developers.com/showthread.php?t=492822
http://developer.android.com/guide/developing/tools/zipalign.html
This fixed my issue