Cordova build for android level api 20 - android

I am trying to build an app made with Angular2 + Ionic2 (ie. Cordova 6) for my android 4.4.4.
I have noticed the version 4.4.4 of android was reffered to the api level 20, so this is the version I have downloaded and installed (api20 + android SDK Build Tools level 20 too). In cordova I have edited the platforms/android/project.properties and platforms/android/CordovaLib/project.properties to build to android-2O instead of the default android-23 api. I have also edited the AndroidManifest.xml.
The issue comes when I try to compile my project with cordova build android, cordova executes some CordovaLib:instructions UP-TO-DATE and bug on CordovaLib:compileDebugJavaWithJavac..
According to the error report which is :
platforms/android/CordovaLib/src/org/apache/cordova/CordovaClientCertRequest.java:25:
error: cannot find symbol import android.webkit.ClientCertRequest;
^ symbol: class ClientCertRequest location: package android.webkit
At the end of all the error report it also says :
You may not have the required environment or OS to build this project
Error: Error code 1 for command:
platforms/android/gradlew with args:
cdvBuildDebug,-b,/Users/thomas/Documents/www/MyProject/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
So I come here to ask for help, because I have no idea what is wrong with Cordova and android-SDK...
Thank you to everyone who helps ;)
Bye !

When you build for Android there is targetSdkVersion and minSdkVersion.
targetSdkVersion indicates wich version of the API will be used to compile the program, not wich version of Android must be on the device the program will be run on.
minSdkVersion indicates the minimum version of android a device must have to be compatible with your program.
If you downgrade the targetSdkVersion, you are limited to older functions and if your program uses the newer functions it will fail to compile (I think it's what happens if you try to compile a Cordova version designed for API 23 with API 20).
By default Cordova (at least for the version 5.1 of cordova-android) uses the targetSdkVersion 23 and the minSdkVersion 14, which means programs should work on devices runing Android Ice Cream Sandwich (4.0) or newer.
In your case, all you have to do is install SDK 23 and don't touch anything to try to change the target SDK.

Related

com.xamarin.forms.platform.android does not exist

I just switched from IntelliJ to Xamarin and, man, am I regretting it. Can anyone help me with this error?
I have a Xamarin.Forms project with .NET standard sharing strategy. I'm receiving the error:
com.xamarin.forms.platform.android does not exist
followed by about 100 errors:
... cannot find symbol.
If I create a new project, the errors still occur.
Android manifest
Minimum version is Android 8.0 (API Level 26 -Oreo)
Target version is the same.
I have also tried each and both with Use Compile using SDK version.
Android SDK
Installed platforms are Android SDK Platform 27 and Android 8.0 - Oreo
Installed Tools are Android SDK 26.1.1 and 27.0.1.
Build tools are all from 26.0.0 to 27.0.3.
Emulator 27.1.7
NuGet - Solution
All packages updated.
Xamarin.Forms version v2.5.0.280555
Android Emulator Manager
Operating System is Android 8.0 - Oreo(API 26)
The only advice I can find is on SO ... and it is to check manifest versions. I'm at a loss now and am unable to work on any project, have lost three days trying to solve it ... and am very close to switching back to IntelliJ. Does anyone have any ideas?

How do I install Android SDK Platform-Tools 24.0.0?

I'm following the guide for setting up the Android N Preview https://developer.android.com/preview/setup-sdk.html
In "Update or Create a Project" Google says I need to have 24.0.0 platform tools.
Just be sure that you've updated your project to use Android SDK Build
Tools 24.0.0 and Android SDK Platform-Tools 24.0.0.
I have installed the new SDK Platform: Android 6.X (N), API Level 24, Revision 1. However when I open SDK Tools the only Android SDK Platform-Tools version is 23.1.
I have updated my build.gradle for Android 24 and for Jack and Java 8 (see).
Everything works great on Android 24 simulator but crashes on a device or simulator running Android 22/23 (less than 24) with the following error:
java.lang.NoSuchMethodError: No virtual method
stream()Ljava/util/stream/Stream; in class Ljava/util/ArrayList; or
its super classes (declaration of 'java.util.ArrayList' appears in
/system/framework/core-libart.jar)
I suspect the cause is having SDK Platform-Tools version 23.1.0 instead of 24.0.0 but if there is another solution i'd be happy to hear it.
Edit
Installing platform tools 24.0.0 rc1 did not fix the crash.
I'm not sure what else to try given that I have followed all the instructions to setup the preview and the Jack compiler.
but crashes on a device or simulator running Android 22/23 (less than 24) with the following error
java.util.stream.Stream was added in API Level 24. This class cannot be used on older devices.
Certain Java 8 features, like lambda expressions, may work on older devices, but not classes that were introduced in Android N.
Just select the show package details and then you can find all the versions. Refer to the attached image
Asuming you have Android Studio 2.1
Launch the standalone SDK manager.
From there Android N API 24 should be available to install
Your API level 24 app runs OK with Android 24 (virtual) device but doesn't work with pre-24 device - so everything is exactly as one would expect.

How can I change the defined API version of an Android app?

I am absolutly new in Android development and I have the following problem trying to build a sample project that I have downloaded from Internet.
When I try to build it I obtain the following error message:
Error:Cause: failed to find target with hash string 'android-18' in: C:\Users\Andrea\AppData\Local\Android\sdk
Install missing platform(s) and sync project
So I search online and I found this SO link: Android studio - Failed to find target android-18
Ok so I go into Tools > Android > SDK Manager and infact I have installed Android 6 corrisponding to the API level 23 but not Android 4.3 corrisponding to API level 18.
So what it means? It means that I have installed a different version o the Android framework ?(is it the SDK considerable as a framework or what?)
So, on Android Studio can I install different version of the SDK?
I think that the API level have to be defined in some way into the dowloaded application. How can I specify to this application to don't use the API level 18 but instead it use the installed API level 23 ? I think that it is not a problem because I have installed a newest version that have to support all the stuff of the oldest one, is it?
I will explain the problem a bit for you and then provide you with the solution.
You are facing this problem, because your project is targeting API level 18 to compile the project. So you MUST have API 18 SDK installed to compile the project.
This is why the IDE is complaining that,
Install missing platform(s) and sync project
The SDK is not the framework. The Android framework is same all over, but with different API levels new updates are pushed to the SDK, the latest being API 23, Marshmallow.
You should not download an older SDK to compile the project.
Always try to use the latest SDK available to work with. So, just head over to your build.gradle file or AndroidManifest.xml file and change the compileSdkVersion to 23.
You can either change the compileSdkVersion version in build.gradle to 23 or whatever version you have in your local machine
You can obtain the API Level 18 from the SDK Manager.
I go into Tools > Android > SDK Manager and infact I have installed Android 6 corrisponding to the API level 23 but not Android 4.3 corrisponding to API level 18.
So what it means? It means that I have installed a different version of the Android framework ?
Yes, you have a newer version of the SDK.
on Android Studio can I install different version of the SDK?
Yes, that is what the SDK Manager is designed for
I think that the API level have to be defined in some way into the dowloaded application. How can I specify to this application to don't use the API level 18 but instead it use the installed API level 23 ?
It is defined. Check either the AndroidManifest.xml or the build.gradle file in the module for the app (not in the project root). You should see some combination of minSdk, targetSdk, and/or compileSdk with a number after it. Since you are getting an error about missing SDK 18, then that number will be 18.
I think that it is not a problem because I have installed a newest version that have to support all the stuff of the oldest one, is it?
The support libraries are separate from the core SDK. You cannot run SDK 23 specific code on devices that have a version less than 23, therefore, to be safe, it is recommended that you start with downloading SDK 18, then run it, then try updating the compileSdkVersion number.

Android version downgrade

Please I am trying to build a small android app with ionic but I downloaded android SDK 5.1.1 .
I wish to deploy to a device that has android version 2.3.3 but it won't even build .
It keeps telling me that the target app is android-22. I want it to build for a lower version like android-8.
Please any help will really be appreciated.
I only want it to be able to build for a lower version
I tried to edit the version in the androidManifest.xml files on my project but still I get errors
->First of all, let`s make sure you have downloaded the plateform for Android 2.2 using Android SDK Manager.
->Set android:minSdkVersion to 8 in androidManifest.xml
->Verify the BuidTarget attribute, since it specifies the development tool of which api to provide you.
->Your problem seems to be the absence of API8 in your SDK.
you might need to change your minSdk in build.gradle
in the app build.gradle file set the min sdk version as 8.
defaultConfig {
applicationId "com.etrade.mobilepro.activity"
minSdkVersion 8
versionCode 87
versionName "4.5"
}
Since the app is not building I guess you don't have that particular sdk.I would suggest downloading the sdk through sdk manager.

Andorid Studio 2.0 Preview 5 Error during launch

the error log goes to
Error installing split apks: com.android.ddmlib.InstallException: Failed to finalize session : -26: Package here.is.packagename new target SDK 22 doesn't support runtime permissions but the old target SDK 23 does.
update project build.gradle targetSdkVersion = 23 will solve the error, but I don`t know why?
You can't downgrade from an app using targetSdkVersion 23 to one using an older targetSdkVersion, as the error says.
Instead, you must fully uninstall the targetSdkVersion=23 version of the app from the device. After that, you'll be able to install the app targeting an older version of Android.

Categories

Resources