I am trying to add https://github.com/nickdrewe/google-analytics-plugin to my cordova project. But the build failed. Here are what I tried:
Install google playservices 21 instead of 19. Edit plugin.xml to point to 21 but still don't work.
Remove google playservices completely and use framework instead https://github.com/nickdrewe/google-analytics-plugin/commit/cb8e78f17472ae2c8b4db613273764a7260b4e34 but still build error
I also tried android update sdk --no-ui --all --filter "extra-google-m2repository" from https://groups.google.com/forum/#!topic/adt-dev/UXW0Hl0UVXk
The error I got:
FAILURE: Build failed with an exception.
* What went wrong:
Failed to notify build listener.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
/vagrant/MyProject/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /vagrant/MyProject/platforms/android/gradlew with args: cdvBuildDebug,-b,/vagrant/MyProject/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /vagrant/MyProject/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /vagrant/MyProject/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
I am using Ionic 1.5.5 and Cordova Android 4.0.2
Any help?
I am open to alternative Google Analytics plugin but I found https://github.com/phonegap-build/GAPlugin causing Android app crashing upon start.
I just tried to reproduce your error - and there is none. I build a new project with the plugin you linked and also the console plugin. The build was totaly fine and successfull.
As far as i see you edited your gradle build settings for speeding up the gradle build. -Dorg.gradle.daemon=true... as far as i read through the documents this must be -org.gradle.daemon=true or is the D sth like an operator or a variable which has to be there?
What you can also try is to run the cmd as an administrator.
Cordova downgrade from 5.1.1 to 4.3.2 fixed the problem for many users.
Related
I am new to ionic. I have developed sample application ionic.
When I try to execute below command it gives gradle error.
$ ionic build android
Below is the build error:
Error: /home/myapp/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred starting process 'Gradle build daemon'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Gradle version is 3.3
Android SDK and Android Studio located in /usr/local/ folder
You will either have to move it to your home directory (that involves reinstall).
Or run ionic build commands with sudo
sudo ionic build android
You could technically change permissions of the specific sdk and studio folders but it is not advisable especially in /usr directory.
when I tried to build the project
ionic build android
or adding this plugin in particular
$ ionic plugin add cordova-plugin-screen-orientation
ir return this problem with licence
$ ionic plugin add cordova-plugin-screen-orientation
WARN: ionic.project has been renamed to ionic.config.json, please rename it.
Fetching plugin "cordova-plugin-screen-orientation" via npm
Installing "cordova-plugin-screen-orientation" for android
ANDROID_HOME=/xxx/Android SDK/adt-bundle-mac-x86_64-20140702/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
Subproject Path: CordovaLib
Incremental java compilation is an incubating feature.
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:
[Google Repository, Android Support Repository].
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.
BUILD FAILED
Total time: 7.315 secs
Failed to install 'cordova-plugin-screen-orientation':Error: /XXX/platforms/android/gradlew: Command failed with exit code 1
at ChildProcess.whenDone (/XXX/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:100:13)
at ChildProcess.emit (events.js:185:7)
at maybeClose (internal/child_process.js:850:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
Error: /XXX/platforms/android/gradlew: Command fail
Help please
Found a solution, the licences I'm looking for are
[Google Repository, Android Support Repository]
to install those I need it to do
$ android update sdk --no-ui --filter extra-android-m2repository,extra-google-m2repository
And that worked for me
I'm trying to get started with Cordova (on Mac Sierra): https://cordova.apache.org/#getstarted
I already have Android Studio (Version 2.2.2) installed and I'm using Android SDK 24.
So I follow the Getting Started instructions...
npm install -g cordova
cordova --version
I have Cordova 6.4.0.
cordova create hello
cd hello
cordova platform add android
This should just work, but I get the following error:
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 24].
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.
BUILD FAILED
Total time: 28.559 secs
Failed to install 'cordova-plugin-whitelist':Error: /Users/richardeng/hello/platforms/android/gradlew: Command failed with exit code 1
at ChildProcess.whenDone (/Users/richardeng/hello/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:829:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
Failed to restore plugin "cordova-plugin-whitelist" from config.xml. You might need to try adding it again. Error: Error: /Users/richardeng/hello/platforms/android/gradlew: Command failed with exit code 1
So what is it with the Mac???
Try to Setup your PATH environment variable on Mac OS like is explained here.
If it doesn't work try to update android studio or just your sdkmanager like i explain on my other answer here.
Anyway android studio make his own android-sdk directory, be sure your cordova project is pointing to the same directory.
i'm beginner in development cordova android ,i want to run my application cordova in the real device by when i excute this command cordova build android i found this error :
:CordovaLib:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':CordovaLib:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/binov1/android-sdk-linux/build-tools/23.0.1/aapt'' finished with non-zero exit value 127
* 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: 29.066 secs
ERROR building one of the platforms: Error code 1 for command: /home/binov1/workElolinkMobile/icooltaxi/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/binov1/workElolinkMobile/icooltaxi/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
You may not have the required environment or OS to build this project
Error: Error code 1 for command: /home/binov1/workElolinkMobile/icooltaxi/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/binov1/workElolinkMobile/icooltaxi/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
try
cordova platform add android
cordova platform build android
adb devices (check if your device appears in the list)
cordova run android
Try installing the android sdk v.23.0.1:
cd /home/binov1/android-sdk-linux/tools
./android
The Android SDK Manager window will open, and you need to select SDK Platform API 23 and Android SDK Build-tools. If you want, you can install all SDK Platform and Build-tools of any API version.
i have installed cordova on linux mint 17.1 xfce, jdk and android and npm is ok and i can create new cordova application and add android platform to it :
cordova create ...
cordova platform add android ..
but when i want to build android i get a error :
cordova build ...
Running command: /home/nasser/Desktop/app/app01/platforms/android/cordova/build
ANDROID_HOME=/home/nasser/android/sdk
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
Running: /home/nasser/Desktop/app/app01/platforms/android/gradlew cdvBuildDebug -b /home/nasser/Desktop/app/app01/platforms/android/build.gradle -Dorg.gradle.daemon=true
FAILURE: Build failed with an exception.
* Where:
Script '/home/nasser/Desktop/app/app01/platforms/android/CordovaLib/cordova.gradle' line: 64
* What went wrong:
A problem occurred evaluating root project 'android'.
> No installed build tools found. Please install the Android build tools version 19.1.0 or higher.
* 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.222 secs
/home/nasser/Desktop/app/app01/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /home/nasser/Desktop/app/app01/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/nasser/Desktop/app/app01/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /home/nasser/Desktop/app/app01/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /home/nasser/Desktop/app/app01/platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
what i can do ?
Once you installed the android sdk, configured ANDROID_HOME and updated the path, you have to run the androidcommand to actually download the sdk tools and android platform.
You don't need to download everything. You can uncheck the system images (keep one if you want to use the emulator), the samples, the sources of android, the docs and android apis older than API 22 (latest android cordova version 4 requires api 22).
Not sure if you still need to install ant with android cordova 4, as it seems they switched to graddle wich is installed automatically.
I had the same problem, and this is the solution for the problem referent to:
No installed build tools found. Please install the Android build tools
version 19.1.0 or higher.
1) You have to go to the android sdk tools folder, for example (in my case) I just wrote the command in my console: $ cd android-sdk-linux/tools
2) Inside this folder you have to write the command
$ ./android list sdk --all and after
$ ./android update sdk -u -a -t 20
And that's all! :)
This will install all the tools you need as well as the system images which are quite large, limit them using the --filter flag
android update sdk --no-ui --all