ionic 6 capacitor cannot change the app version on android - android-studio

I am using Ionic 6 and capacitor in a project.
In the config.xml file I have:
<widget xmlns="w3.org/ns/widgets"; xmlns:cdv="cordova.apache.org/ns/1.0">
When I try to change it to:
<widget version="0.0.1" xmlns="w3.org/ns/widgets"; xmlns:cdv="cordova.apache.org/ns/1.0">
and then do ionic build android the version disappears and nothing is changed in the AndroidManifest.xml file.
When I import the apk or other into google play to test it tells me that the version already exists.
So how do I change the app version?

Forget about config.xml, that’s a cordova thing and not used in capacitor (other that being there for the cordova plugin compatibility).
In capacitor apps you manage the version as you would do in a native android app, that’s changing the values in the android/app/build.gradle file.
There are two fields:
versionCode: this is the version you have to increment every time you submit a new version to google play. It’s an integer.
versionName: this is the visible version that will be displayed in google play. It’s a string.

Related

Plugins or methods not found in Android Studio in an Ionic and Capacitor project

Sorry if my English is bad, my level is not very high.
I am developing a mobile app with Ionic and Capacitor. Some Capacitor plugins like Share or Splash Screen were installed.
These are the versions:
ionic: 6.12.4
capacitor: 4.1.0
In Android Studio I have SDK version 9 and Gradle version 7 installed and I ran into the following issue since I added Capacitor.
When I open Android Studio and try to create an APK, I get errors like 'package not found...' for the plugins mentioned above. I have tried installing jetifier but it keeps giving me the same error.
I put an example screenshot of what appears to me with the Capacitor Share plugin but it also happens to me with the other Splash Screen add-on.
example bug Android Studio
Thanks.

Ionic Capacitor still referring to cordova-support-google-services on Android builds, when removed

I recently updated my Ionic 5 app to Capacitor. Originally i have using notification messages with Firebase using the cordova libary '#ionic-native/push/ngx.
I also had cordova-support-google-services installed, therefore i also removed it thinking Capacitor already includes notification plugin.
Now when i try to preform a RUN using "ionic capacitor run", Android Studio starts, i get the follow output
org.gradle.api.resources.MissingResourceException: Could not read script 'G:\AVR_Project\Ionic Projects\app\node_modules\cordova-support-google-services\build.gradle' as it does not exist.
It seems like it is still trying to use the cordova version, that i removed and not the default capacitor version.
Am i doing something wrong?
after you uninstall the plugin, run npx cap sync android, that should remove the gradle reference from the plugin

Cordova Crosswalk: installation of Andoird-apk failed

I'm using cordova-plugin-crosswalk-webview-v3 to create android app with a build-in browser as standard webview in my app.
Cordova can create very simple a android app without any problem. As I added crosswalk (latest version) in cordova, my export are in 2 versions: arm64 and x86_64.
The problem is I cannot install both created apps on my android-device or emulator of android-studio.
I have 2 kind of errors:
first:
after importing the .apk in android-studio : .*so missing
second
after try to running app: INSTALL_FAILED_NO_MATCHING_ABIS
can somebody help me to solve this problem? I also read some issues on github of crosswalk, but they are not interested to replay their issues.
Thank you for your help!
The solution is to set android-minSdkVersion in config.xml to the latest version, like 28. Also just add this code in your config.xml and build the app via cordova build android again:
<preference name="android-minSdkVersion" value="28" />
After that there is a new apk-output, which names debug.apk. This apk is universal and can run on any devices.

cordova hybrid app build fail with vs2013 up2 (chinese traditional)

I build cordova project with vs2013 up2 for windows phone platform and receive some error as follow , but build for ios & android is ok .
(1)Non-whitespace before first tag.
I found the js file "C:\Users\xxx\AppData\Roaming\npm\node_modules\vs-mda\node_modules\cordova\node_modules\plugman\src\util\xml-helpers.js" in line 124 command
var contents = fs.readFileSync(filename, 'utf-8').replace("\ufeff", "");
...is failing in chinese traditional environment, when building for windows phone platform the WMAppManifest.xml file has BOM code , so will be error as 嚙踝蕭??xml version="1.0" encoding="utf-8"?>, it should be <?xml version="1.0" encoding="utf-8"?>
have any idea can fix it ?
Thanks.
The issue you are seeing (issues.apache.org/jira/browse/CB-5477) was fixed in Cordova 3.5
(I'm a new poster and haven't earned the reputation points to include more than 2 links in my response, so I'm saving those for the ones that matter below).
If you update to the latest CTP 2.0 for Multi-Device Hybrid Apps, you will pick up the fix.
Unfortunately, there is an other Cordova issue that still exists in version 3.5 which also impacts WP8 in localized environments (https://issues.apache.org/jira/browse/CB-6932).
It has been fixed in Cordova version 3.6 which hasn't yet been released, but here's how you can pick up the fix.
After installing the new MDD tools, create an MDD project and build for WP8. (It will fail under Chinese as it did before.)
Now go into c:\Users\<username>\cordova\lib\wp\cordova\3.5.0\wp8\bin
Replace the existing create.js with the version from here
(click "Raw" to view just the file contents)
https://github.com/MSOpenTech/cordova-wp8/blob/ac097f2801d4defe5e4d445e10b7102001631a54/wp8/bin/create.js
Create a new project and build again for wp8. It should work now and future projects should work as well.
For me, it worked by removing android and adding again.
remove:
ionic platform rm android
add:
ionic platform add android
You can execute these commands at your project directory.

Change target sdk on Phonegap for nodejs

Im using phonegap on nodejs, but when I use the command
phonegap local build android
It automatically ask me for "Android 4.2 SDK"
Please install Android target 17 (the Android 4.2 SDK). Make sure you
have the latest Android tools installed as well.
How can I choose a lower vesion (android 4.1) of the sdk using phonegap for nodejs?
Short answer: you don't have to!
I struggled with this until I installed v17 and completed my first build. It turns out that the generated Androidmanifest.xml has minSdkVersion=10, so the minimum version required for your application is 2.3.3, it just needs to compile against v17.

Resources