Unable to create mfp cordova project in Android 28 - android

Latest Android SDK is not letting me use android command, as it is deprecated to create a mfp cordova project.
I'm using IBM MobileFirst CLI v7.1.0.00.20180706-0858 and latest Android SDK & Android Studio.
May I know any work around to create a project with mfp cordova?
Updated
Steps to reproduce the issue:
1) Download and install the latest Android Studio and download the latest Android SDK using sdkmanager. Set the system variables to the downloaded SDK buildtools and tools.
2) Download and install the latest MFP CLI v7.1.0.00.20180706-0858.
3) Run mfp cordova create in the command line and the following error happens.
MFP cordova project create Error Screenshot
Android Deprecated Screenshot
Thank you

MobileFirst CLI contains an instance of Cordova CLI v5.0.0, Android platform version 3.6.4.For more details see here :
https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.1/hello-world/integrating-mfpf-sdk-in-cordova-applications/
Cordova-Android#3.6.4 works only with older tools of android such as Android target: android-23.In your case you have updated your platform tools to latest that is why you are seeing such error.
I have uploaded older tools of android here :
https://ibm.box.com/s/je74bzx73y6je65tdnpttyns4ih1zj7b
Rename or take back up of your existing tools in android sdk path.Put uploaded tools in android sdk path.
With Android P that is targeting to API 28 with MobileFirst 7.1 app ,you may face an error java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/params/BasicHttpParams;
Work around is to add below tag in AndroidManifest.xml inside the tag:
Google's issue tracker
The same has been update in the
Android P blog

Related

Ionic can not add android

I try to uninstal cordova then instal again but still not working
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd platform add android exited with exit code 1.
Re-running this command with the --verbose flag may provide more
information.
It looks like you need to install your android SDK/build tools.
You can do it manually or using your android studio installation if exists.
To do it with Android Studio you can:
Go to settings->Appearance and Behavior->Android SDK
Go to the SDK Platforms tab and select the latest Android SDK
package.
Go to the SDK Toos tab and select the following checkboxes:
Android SDK Build-Tools
Android SDK Platform-Tools
Android SDK Tools
NDK
Android Support Repository
Google Repository
Apply and accept
To do it without using Android Studio there's an answered question here: How do I download the Android SDK without downloading Android Studio?

How to specify the Android API version by adding in Cordova

After creating a mobile-first Cordova project with the command:
cordova create cordovatest1 com.sample.cordova cordovatest1 --template cordova-template-mfp
I add the Android platform to the project with the command:
cordova platform add android
the question is why the Android version for the platform which was just added takes the Android API 23 / android version 5.1.1, even I have already other API levels: 22, 25, 27 in SDK manager?
is there a config file belong to Cordova says that the Android platform must be for example android-23 if the developer didn't specify the Android version by adding like
cordova platform add android#6.1.2
or maybe the mobilefirst-cli witch is already installed under the version 8.0.0 force that adding platforms?
This screenshot can give you more details
This is unrelated to IBM MobileFirstPlatform SDK plugin. The Android target is determined by your Cordova version.
For example, cordova-android#6.1.2 targets Android API Level 25.
cordova-android#6.3.0 targets Android API Level 26.
Details here.
You have not mentioned your Cordova CLI version. Since you see cordova-android#5.1.1 being added, it seems to be Cordova CLI version 6.0.
The results would be the same if you were to create a blank Cordova project ( without cordova-template-mfp) and then add platform.
why the Android version for the platform which was just added takes
the Android API 23 / android version 5.1.1
Because you have saved Android 5.1.1 in npm-cache.
Check npm-cache folder:
C:\Users\Training\AppData\Roaming\npm-cache\cordova-android
Currently the Cordova android platform versions supported by the MobileFirst plug-ins, is:
cordova-android: >= 6.1.2 and < 9.0
Try using these command:
To upgrade:
cordova platform update android#9.0
To add it explicitly:
cordova platform remove android
cordova platform add android#9.0
or
cordova platform add android#latest
For more details see here : https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/application-development/sdk/cordova/

Cordova does not "see" Android SDK version

I am in the process of setting up a new Cordova CLI toolchain to build hybrid Android apps that target Android 5.1+. I am using
Node 8.9.2
Cordova 7.1.0
After issuing a cordova create... command to create a new Cordova project I proceeded to add Android 5.1 using cordova platform add android#5.1.0 which went smoothly.
I have also ensured that I have the relevant Android SDKs available and pointed at properly via ANDROID_HOME. I currently have SDKs 19 through to 27 installed.
However, when I issue a cordova build android I get the message Error: Android SDK not found. Strangely enough if I let Cordova install its current default Android version via cordova platform add android which adds Android 6.3.1 it then lets me build the project without any further ado.
Is this a matter of Cordova 7.1.0 simply not wanting to play ball with lower versions of Android or is there something else going on here? Can I get around this by installing an older version of Cordova via npm? If so, which version should I install - and how?
Your problem is you're adding an old version of the cordova-android platform project, (v5.1.0) which is over 2 years old and not compatible with the cordova#7.1.0 CLI.
If you want to target Android 5.1+, you don't need to use cordova-android#5.1.0, you need to specify a preference in the config.xml to target Android 5.1 (API 22) and above:
<preference name="android-minSdkVersion" value="22" />
You probably want to use the default cordova-android platform version (6.3.1), unless you need to do stuff with Android Studio 3, in which case use cordova platform add android#latest which will add cordova-android#7.0.0 and requires Gradle 4 to build (see here).

PHONEGAP - Error while starting emulated android on phonegap; I use the SDK installed by android Studio

The error I get on the console; When I run the command "phonegap emulate android"
->Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK. Looked here: C:\Users\wende\AppData\Local\Android\sdk\tools\templates\gradle\wrapper
I also experienced this issue (among many others) in my attempts to get a phonegap app to work in my environment.
I found a solution in the second response (by jcesarmobile) to this question:
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK - Android
Specifically, I had to make sure my Android Studio and Android SDK Tools were updated to the latest version, and then I had to update my Cordova Android platform to version 6.2.2.
phonegap cordova platform rm android
phonegap cordova platform add android#6.2.2

Can't build android project in IONIC framework

I'm trying to build my test app for android device with IONIC framework using WEB technology.
I installed IONIC FRAMEWORK and configured everything with the help of Ionic Framework Docs.
And now I am trying to build android app using command line:
ionic build android
But this gives me Error to install the following targets:
ERROR: Please install android target: "android-23"
I Have a problem to understand about android-23. What's this and how to install it for my android platform tools.
I also updated SDK platform tools and SDK build tools.
API level 23 stands for marshmallow ,have you installed the Android SDK successfully .just check this link,https://googleweblight.com/?lite_url=https://source.android.com/source/build-numbers.html&ei=7Sw_Jjql&lc=en-IN&s=1&m=141&host=www.google.co.in&ts=1458486558&sig=APY536yicvyJBcnb8fM_Ldmz-Kzx9dINVQ

Categories

Resources