Ionic/Cordova - App only installing on nougat - android

I have recently started using ionic/cordova and I am currently in the process of testing my app on different android platforms. In my config.xml file, I set my minSdkVersion and targetSdk to 19 (Kitkat) and my maxSdkVersion to 26 (Oreo) like so.
<platform name="android">
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="19" />
<preference name="android-maxSdkVersion" value="26" />
When I add my android platform this carries through into the AndroidManifest.xml like it supposed to. After I run ionic cordova build android --prod --release and continue to sign the app as according to the deploying docs on the ionic site, I try installing the apk on different devices. It installs and works fine on nougat devices but on marshmallow and kitkat devices it doesn't install at all.
When I run ionic cordova platform add android --save it says:
Using cordova-fetch for cordova-android#~6.3.0 Adding android
project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: io.ionic.starter
Name: Lock_Ninja
Activity: MainActivity
Android target: android-26
Subproject Path: CordovaLib
According to other forums the change made to the config.xml file is suppose to overwrite the Android Target shown above. But despite all this, the apk only installs on nougat devices. How can i fix this?
ionic: version 3.19.0 cordova: 7.1.0 cordova-android#6.3.0
AndroidSdkBuildTols: 27.0.3

The problem has been solved here https://forum.ionicframework.com/t/apk-only-installs-on-nougat-devices/118517/2?u=uvir127
Basically the package name of app was conflicting with an already installed app with the same name

Related

Phonegap CLI - how to update android to 8.0.0 (cordova 9.0.0 CLI)

I reinstall my cordova and phonegap and still have 7.1.1 android version in project.
How to get 8.0.0 android platform?
A lots plugin based on android sdk needs cordova 9.0.0 or above, but newest phonegap have only 7.1.1.
At times, you need to specify the version which you want to install. Please execute the below commands in the same order. Also, Cordova Android 8.1.0 is the latest!
cordova platform remove android
cordova platform add android#8.1.0
Add this to your config.xml
<preference name="phonegap-version" value='cli-9.0.0' />
The baove code is can be used if you are using Phonegap Build as well.

How can I set the target Android SDK for Cordova?

For a new Cordova project, I want to add Android as a platform using
cordova platform add android
And I want to use Android version 16. So I set these properties in the config.xml
<preference name="android-minSdkVersion" value="16" />
<preference name="android-targetSdkVersion" value="16" />
And I run
cordova platform add android --target android-16
Yet what I see in the logging is
Using cordova-fetch for cordova-android#~6.3.0
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: io.cordova.hellocordova
Name: HelloCordova
Activity: MainActivity
Android target: android-26
So it still targets Android 26 instead of 16. Indeed, when I run cordova build, it builds using Android version 26. Why is that? What can I do to fix this?
The syntax you use to provide android version is wrong.
Instead of
cordova platform add android --target android-16
it should be
cordova platform add android#16

Cordova android mapped to which android API

When using Cordova I want to build for Android API version 23.
When I do cordova platform add android then when I build the app by doing cordova build android. It builds for API 25 by default.
How do I go about setting the correct api version. Also mention what is to be installed in the Android-sdk.
Thanks
How do I go about setting the correct api version
In your config.xml, use a <preference> to set it:
<preference name="android-targetSdkVersion" value="23" />
Also mention what is to be installed in the Android-sdk
The API 23 platform SDK needs to be installed.
See the Cordova Android platform guide for more details.

Unable to change Installed platforms for android in apache cordova for visual studio

I am trying to upgrade Installed platforms to android 5.0.0 in Visual Studio Tools for Apache Cordova project by using Cordova CLI command when i run command debugg path platform will upgrade to 5.0
consol screenshot
but when i again rebuild project it reset to old version 3.7.2 , yes it will reset to older version when project build but how can i upgraded android version globally so when i build it again it show upgraded android version.
i added this in config file
<preference name="android-minSdkVersion" value="21" />
<preference name="android-targetSdkVersion" value="23" />
<preference name="android-maxSdkVersion" value="23" />
installed SDK platform for API 23 in SDK manager but still same.
From the configuration file in your Cordova app, select platform and check the checkbox to use the globally installed cordova CLI version.
This update is available if your have TACO tools update 5 in VS 2015.
Hope this helps.
From the cli run: Cordova platform add #.

Changing the android target of a cordova project

i'm new to cordova development and i created my first cordova project using this command as in following site
https://cordova.apache.org/docs/en/4.0.0/guide_cli_index.md.html
cordova create hello com.example.hello HelloWorld
After used these commands to add a platform to project,
cd hello
cordova platform add android
and command line gives these output
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.exampple.hell
Name: helloWorld
Android target: android-21
Copying template files...
Project successfully created.
according to this Android target of this project is android-21 but installed android SDK on my machine only has up to android API level 19. So when i import these project to eclipse IDE to make further changes to project it gives error on console
Unable to resolve target 'android-21'
I changed AndroidManifest.xml file as
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
but still have the problem.
can i change the android target to 19 when the platform is added to project or is there another way to fix this and run project with android API level 19
You should update your SDK on your machine first of all. The compatibility depends on your config.xml file content.
For example you want to support android levels from 16 to 19, then this part of the config.xml should look like this:
<preference name="android-minSdkVersion" value="16"/>
<preference name="android-targetSdkVersion" value="19"/>
The build method then takes care of AndroidManifest.xml.

Categories

Resources