Can't open Ionic Framework compiled project in Android Studio - android

I'm currently working on Ionic Framework based Android App. I've complete setup of Android Studio & Android SDK.
Android Studio 2.2.2
Android SDK Tools 25.2.2
Android SDK Platfrom Tools 25.0.0
Android SDK Build Tools 25.0.0
Android SDK Platform 24 rev. 2
Android SDK Platform 23 rev. 3
Android Support Repository 39
Google Repository 37
The ionic build android & ionic emulate android commands works fine. but, When I'm attempting to open build project in Android Studio, it throws the following error.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':CordovaLib:processDebugAndroidTestResources'.
> A problem occurred starting process 'command 'E:\Android\android-sdk\build-tools\25.0.0\aapt.exe''
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
I can't figure out what's going wrong. Any suggestions or help are welcomed.
Thanks in advance

check E:\Android\android-sdk\build-tools\25.0.0.for aapt.exesome times it occur due to missed options or ircorrect directory

Related

Unable to run flutter project. Asking for specific NDK version

Launching lib\main.dart on M2004J19C in debug mode...
What went wrong:
A problem occurred configuring project ':flutter_libserialport'.
NDK at C:\Users\M.K. Malik\AppData\Local\Android\sdk\ndk\21.1.6352462 did not have a source.properties file
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 2m 47s
Running Gradle task 'assembleDebug'... 175.8s
Exception: Gradle task assembleDebug failed with exit code 1
How to fix or install that specific NDK version?
Firstly check your NDK version using android studio
Go to Tools->SDK Manager (or Files->Settings->Appearance & Behavior->System Settings->Android SDK ). Then select the SDK Tools tab, and check the Show Package Details checkbox. You will see your NDK version.
You can also easily install or upgrade new NDK version using android studio -> SDK manager -> SDK tools . Select the show package detail checkbox. You will be able to see all the NDK versions available.
The error displayed by you shows that some file in missing from the NDK version you have my suggestion is you should reinstall that version
You need to download NDK from SDK Manager in SDK Tools Tab (select show package details)
In Some Cases, CMake also needed which is also available in SDK Tools tab
And in app/build.gradle file you need to specify the version
like this
ndkVersion "25.1.8937393"

Ionic build time error "No installed build tools found. Install the Android build tools version 30.0.3 or higher"

I'm stack on one error in on build time with Cordova.
I have already installed android build tools but ionic through error "No installed build tools found. Install the Android build tools version 30.0.3 or higher". I do not understand why this error show. Below mentioned error, please check and help me.
ANDROID_HOME=C:\Users\prade\AppData\Local\Android\Sdk (DEPRECATED)
Using Android SDK: C:\Users\prade\AppData\Local\Android\Sdk\build-tools\32.0.0
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
Where:
Script 'C:\ionic\demoApp\platforms\android\CordovaLib\cordova.gradle' line: 69
What went wrong:
A problem occurred evaluating script.
No installed build tools found. Install the Android build tools version 30.0.3 or higher.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
Command failed with exit code 1: C:\ionic\demoApp\platforms\android\gradlew :app:bundleRelease -b C:\ionic\demoApp\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --release exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
The error produced by Cordova is misleading (there is an open issue here).
Cordova by default is looking for build tools version >= 30.0.3 but still within version 30. The purpose for this behaviour is so Cordova doesn't automatically pick up a build tools version that it is likely not compatible with.
Using <preference name="android-buildToolsVersion" value="32.0.0" /> should allow you to override this behaviour and Cordova will use the desired build tools version as requested.
However there are known incompatiblities with Build tools version 31, and I doubt build tools 32 will work either. I'd highly suggest installing build tools 30.0.3 as that's the version that is tested against the current version of cordova.
Navigate to your android build tools directory
C:\foo\sdk\build-tools\32.0.0
and rename d8.bat to dx.bat
Now do the same for d8.jar in the /lib folder.
Credits go to 'user16475264' (https://stackoverflow.com/a/68430992/3365033)

Could not find any version that matches com.google.android.gms:play-services-gcm:12+ (

I'm trying to compile on ionic 3.20 with cordova 6.5.0 on Android.
I'm executing cordova run android but everytime I'm getting:
Error: ~/Develop/blastbot-ionic/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all dependencies for configuration ':_debugApkCopy'.
> Could not find any version that matches com.google.android.gms:play-services-gcm:12+.
Versions that do not match:
11.0.4
11.0.2
11.0.1
11.0.0
10.2.6
+ 18 more
Required by:
:android:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I have all this installed:
SDK Manager
I've already tried executing cordova platform rm android & cordova platform rm android#6.2 or cordova platform rm android. Both ending in the same result. Downloaded a million different SDK's versions.
I tried cordova platform add android#5 and afterwards cordova run android and it worked like a charm.
UPDATE
The line abov "solved" the issue partially, but my targeted API level was 23 instead of 25. The issue, after almost month and a half of trying different SDK tools/build-tools/Google repo combinations I found the solution.
Navigate to platforms/android/project.properties and look for a line like
cordova.system.library.2=com.google.android.gms:play-services-gcm:12+
Notice that 12+ at the end. Simply change it to 11+, that will do the job. Hope nobody goes through this like I did.

Why can't I run my Cordova Project in Android?

I am trying to run my Cordova Project in a Android platform on a Mac.
I downloaded Android Studio.
However, whenever I try to run the following command line in terminal
cordova run android
it ends in the following error:
BUILD FAILED
Total time: 1.391 secs
Error: /Users/karel/Cordova Projects/demo/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 25].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Am I missing something?
It works for
cordova run ios
cordova run osx
cordova run browser
How can I accept these terms the message is talking about? I recall accepting to certain terms, at least, when downloading Android Studio.
I am wondering whether I have to install Android SDK separately from Android Studio or something. (I have no experience with Android).
Thanks for your time. Your help would mean a lot.

Ionic Run Faild

I can run my ionic project on android device perfectly until now but now this error is happens. I did not change anything in project structure.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugCompile'.
> Could not find any version that matches org.xwalk:xwalk_core_library_beta:13+.
Searched in the following locations:
https://repo1.maven.org/maven2/org/xwalk/xwalk_core_library_beta/maven-metadata.xml
https://repo1.maven.org/maven2/org/xwalk/xwalk_core_library_beta/
https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library_beta/maven-metadata.xml
file:/Applications/android-sdk/extras/android/m2repository/org/xwalk/xwalk_core_library_beta/maven-metadata.xml
file:/Applications/android-sdk/extras/android/m2repository/org/xwalk/xwalk_core_library_beta/
file:/Applications/android-sdk/extras/google/m2repository/org/xwalk/xwalk_core_library_beta/maven-metadata.xml
file:/Applications/android-sdk/extras/google/m2repository/org/xwalk/xwalk_core_library_beta/
Required by:
:android:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 20.525 secs
/Users/myuser/Projects/appname/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/myuser/Projects/appname/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/myuser/Projects/appname/platforms/android/build.gradle,-PcdvBuildArch=x86,-Dorg.gradle.daemon=true
I removed android platform and all node_modules and added them again but still i see this error.
i can serve my app and run on IOS simulator perfectly.
I had the same problem!
I solved it with the following steps:
Remove browser with ionic browser revert android
Install crosswalk again ionic browser add crosswalk
Deploy aplication ionic run android
I had same problem, on run time I used VPN in ionic build android and Ionic run android command. this will help to reach the website to download components.
Also about the maven
I run CMD command with "Run as Administrator" it started to download maven and after that it works fine for me.
Before this I used to upgrade JDK and JRE but has not change in result.
I have upgraded Windows 7 to Windows 10 directly and some times applications needs to start by using "Run As administrator"
I have found the solution for the problem using the google play service and Google Repository in android SDK
Please install the following dependency using android SDK manager Google Play services and Google Repository
Once the installation is completed then you create your project and run.
Now it should work fine

Categories

Resources