Android Build failed after adding Crosswalk to Ionic - android

Got excited about Ionic adding Crosswalk and now my project won't build. The project was compiling and working before updating and adding Crosswalk. Anyone have any suggestions on how I can correct the error below? I prefer not to rollback. Thank goodness for version control :)
System information:
OS: Windows 8
Node Version: v0.10.32
Cordova CLI: 4.2.0
Ionic Version: 1.0.0-beta.14
Ionic CLI Version: 1.3.1
AngularJS v1.3.8
WARNING [Project: :org.apache.cordova.engine.crosswalk:382300-xwalk_core_library] Current NDK support is deprecated. Alternative will be provided in the future.
:mergeDebugResourcesC:\Users\platforms\android\build\intermediates\exploded-aar\android.org.apache.cordova.engine
.crosswalk\rsgapp382300-xwalk_core_library\unspecified\debug\res\drawable-hdpi-v4\color_picker_advanced_select_handle.png
ERROR: Unable to open PNG file
Error: Failed to run command:
C:\Users\AppData\Local\Android\sdk\build-tools\21.0.2\aapt.exe s-i C:\Users\platforms\android\build\intermediates\exploded-aar\android.org.apache.cordova.engine.crosswalk 382300-xwalk_core_library\unspecified\debug\res\drawable-hdpi-v4\color_picker_advanced_select_handle.png -o C:\Users\platforms\android\build\intermediates\res\debug\drawable-hdpi-v4\color_picker_advanced_select_handle.png
Error Code: 42
Output: C:\Users\platforms\android\build\intermediates\exploded-aar\android.org.apache.cordova.engine.crosswalk382300-xwalk_core_library\unspecified\debug\res\drawable-hdpi-v4\color_pick
er_advanced_select_handle.png
ERROR: Unable to open PNG file
:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':mergeDebugResources'.
Error: Failed to run command: C:\Users\AppData\Local\Android\sdk\build-tools\21.0.2\aapt.exe s -i C:\Users\platforms\android\build\intermediates\exploded-aar\android.org.apache.cordova.engine.crosswalk 382300-xwalk_core_library\unspecified\debug\res\drawable-hdpi-v4\color_picker_advanced_select_handle.png -o C:\Users\platforms\android\build\intermediates\res\debug\drawable-hdpi-v4\color_picker_advanced_select_handle.png
Error Code: 42
Output: C:\Users\platforms\android\build\intermediates\exploded-aar\android.org.apache.cordova.engine.crosswalk382300-xwalk_core_library\unspecified\debug\res\drawable-hdpi-v4\color_picker_advanced_select_handle.png
ERROR: Unable to open PNG file

Looks like you were getting similar errors to this question, which was that on Windows, path names are restricted to 260 characters, so moving to a directory with a shorter path name should fix your issues.

Related

Meteor APK build broken with accounts-google

We can no longer build our APK with accounts-google. Obviously, this is a serious blocking issue.
This build was working fine as recently as two days ago. Now it would seem that Google have once again broken something.
Steps to produce the issue:
$ meteor create broken-gooogle-oauth-test
$ cd broken-gooogle-oauth-test
$ meteor add-platform android
$ meteor add accounts-google
$ meteor build --verbose ~/test-build --server=http://www.example.com
or...
$ meteor run android-device
Either way, you eventually will see a long list of error messages, starting with:
/home/mad/.gradle/caches/transforms-1/files-1.1/core-1.0.0.aar/37baf6a1e42da25347f527a778e640b7/res/values/values.xml:133:5-70: AAPT: error: resource android:attr/fontVariationSettings not found.
/home/mad/.gradle/caches/transforms-1/files-1.1/core-1.0.0.aar/37baf6a1e42da25347f527a778e640b7/res/values/values.xml:133:5-70: AAPT: error: resource android:attr/ttcIndex not found.
/home/mad/androidTest3/.meteor/local/cordova-build/platforms/android/app/build/intermediates/incremental/mergeReleaseResources/merged.dir/values/values.xml:92: error: resource android:attr/fontVariationSettings not found.
/home/mad/androidTest3/.meteor/local/cordova-build/platforms/android/app/build/intermediates/incremental/mergeReleaseResources/merged.dir/values/values.xml:92: error: resource android:attr/ttcIndex not found.
error: failed linking references.
Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
at sun.reflect.GeneratedMethodAccessor184.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> Failed to execute aapt
The cause of this is the June 17th update of the google android libs, which make API 28 the required minimum SDK version. API 28 introduces some new XML attributes, such as ttcIndex and fontVariationSettings referenced in your error.
In this case the plugins in question are com.google.android.gms:play-services-auth and com.google.android.gms:play-services-identity
Unfortunately there isn't an easy way of fixing this, apart from hacking the meteor output in .meteor/local. There are two approaches:
force API 28 (obviously you'll need to download the required API files)
change the :+ version requirement in cordova-plugin-googleplus to the latest version that supports API 27 (e.g., before June 17th).
Option 1 is the cleanest if you can manage it, in .meteor/local/cordova-build/platforms/android edit project.properties and set target=android-28
Option 2 is harder, but better if you're not ready to update everything to API 28. You'd need to edit the plugins plugin.xml file or find where those files are referenced in a .gradle file somewhere.

Ionic 3 BUILD FAILED with Cordova: cordova\node_modules\cordova-common\src\superspawn.js:169:23

In Ionic 3 with Cordova when I give the command:
ionic cordova run android --device
i have already installed and set the path in system environment
JDK
SDK
Node js
I have researched a lot on the internet and I can not solve it. What can I be doing wrong?
Even formatting the computer already formatted. I do not know what to do. Neither messages from other forums with the "supposed" same error, did not work out.
It gives me the following errors:
`E:\NAB\ionic\new\myApp>ionic cordova run android
Running app-scripts build: --platform android --target cordova
[12:54:42] build dev started ...
[12:54:43] clean started ...
[12:54:43] clean finished in 16 ms
[12:54:43] copy started ...
[12:54:44] deeplinks started ...
[12:54:44] deeplinks finished in 203 ms
[12:54:44] transpile started ...
[12:54:58] transpile finished in 14.50 s
[12:54:58] preprocess started ...
[12:54:58] preprocess finished in less than 1 ms
[12:54:59] webpack started ...
[12:54:59] copy finished in 15.94 s
[12:55:32] webpack finished in 33.82 s
[12:55:32] sass started ...
[12:55:38] sass finished in 5.26 s
[12:55:38] postprocess started ...
[12:55:38] postprocess finished in 78 ms
[12:55:38] lint started ...
[12:55:38] build dev finished in 55.31 s
> cordova run android
Android Studio project detected
ANDROID_HOME=C:\Users\Sohail Akbar\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_171
studio
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find gradle-core.jar (com.android.tools.build:gradle-core:3.0.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle-core/3.0.0/g
radle-core-3.0.0.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
[12:55:47] lint finished in 9.31 s
(node:2132) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with ex
it code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find gradle-core.jar (com.android.tools.build:gradle-core:3.0.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle-core/3.0.0/g
radle-core-3.0.0.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
at ChildProcess.whenDone (E:\NAB\ionic\new\myApp\platforms\android\cordova\n
ode_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:2132) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). (rejection
id: 1)
(node:2132) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre
cated. In the future, promise rejections that are not handled will terminate the
Node.js process with a non-zero exit code.`
thanks in advance
Sorry for my bad English, I will try my best to present the answer in easy way.
I just spend my two days and nights on solving the same issue and finally I found one.
The main problem is with the Android-NDK.
Ionic framework is looking for mips64el-linux-android package in the ndk-bundle folder of Android SDK.
If You visit Your Android-SDK folder, You will find a folder with name ndk-bundle, inside this open the folder name toolchains You will see that toolchains doesn't contains the package mips64el-linux-android.
You have to download it manually.
You can download the latest version of Android-NDK here, but unfortunately this latest version doesn't contain the package we need.
At the bottom of this page You will find a link to download the older versions of Android-NDK, follow that link and download Android NDK, Revision 14b (March 2017). That's the NDK version Ionic looking for.
Now go to Your Android-SDK path, then NDK-Bundle and delete everything from that folder. And extract the downloaded file in NDK-Bundle folder, You will see the package mips64el-linux-android.
Everything is good to go now.
Hope so it will work.
Below is a summation of my experience installing cordova on ionic-4. See in particular the section on mips64el-linux-android error. Just follow along and create the dummy folder and subfolders as explained.
Cordova expects to see the path to C:\Users\myusernamehere\AppData\Local\Android\Sdk\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\bin\mips64el-linux-android-strip but does not require it (in my case) and will throw an error if absent.
Ionic Cordova Installation experience.
• Re- install Java JDK 8 to the latest update.
• Add ANDROID_SDK_ROOT variable to point to existing installation of Android Studio SDK
• Add Java JDK\bin to the environment PATH variable on user and system
• Download Gradle 5.2 and create folder C:\Gradle and extract the contents inside. Your
The path should look like this
C:\Gradle\gradle-5.2\bin\gradle.bat
Add "C:\Gradle\gradle-5.2\bin" to PATH variable on System
From the command line do the following ..
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
• Using a previously installed edition of Android Studio go to Tools => SDK Tools
And check the NDK checkbox for download, click apply and ok.
• In the project terminal - Enter
ionic cordova prepare android
to build Cordova.
If there are errors delete the platforms\android project directory and rebuild.
If there is a Gradle error looking for NDK "mips64el-linux-android-version"
Do the following ..
• Open the NDK bundle\toolchains folder within Android SDK eg C:\Users\Shay\AppData\Local\Android\sdk\ndk-bundle\toolchains
• And using command line create a folder "mips64el-linux-android-4.9" ( same version number (4.9) as other folders) inside create folder "prebuilt" .. then folder "windows-x86_64" and inside place and empty text file for contents.
The created path should look like .. "C:\Users\Shay\AppData\Local\Android\sdk\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\dummy file" is not required by Cordova but is expected to be in its path .. otherwise it will throw an error and fail to build.
Alternatively, download an older build such as https://developer.android.com/ndk/downloads/older_releases/android-ndk-r16b-windows-x86_64.zip and extract the required folder to the new ndk folder in the same location as above.
• Finally, once again enter
ionic cordova prepare android
to build Cordova
The Ionic build order (as I observed it) is a follows ..
1. It looks for all the relevant Java and Android SDK paths ..
2. Then uses Gradle as the build system ..
3. Check for NDK bundle ..
4. Build project
The above took me two days to figure out. Hope it helps and saves you the headache.

Cordova build to Android error

I made an app with Construct 2 and I exported to Intel XDK. Then I exported to cordova and everytime I try to build with "cordova build android" I get this error:
ERROR: In FontFamilyFont, unable to find attribute android:t
tcIndex
FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
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: 47.337 secs
Command finished with error code 1: cmd /s /c "C:\Users\Gustavo\app\platfo
rms\android\gradlew.bat cdvBuildDebug -b C:\Users\Gustavo\app\platforms\an
droid\build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pand
roid.useDeprecatedNdk=true"
Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:ttcIndex
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
It's my first time posting here, so if I am doing something wrong, please tell me.
Thanks for the help!
I got a build successful by adding this in the build-extras.gradle file:
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
And by installing the cordova-android-support-gradle-release.
Gustavo,
Its is possible that you have a conflict in cordova plugins or platform. A second possiblity is that, you have added components via npm but haven't installed it. For both scenario, I suggest that you list out the current versions installed, note them down then do an update to cordova. Here is how to list out the versions, like what I have.
cd projectfolder
$ cordova plugin
cordova-plugin-console 1.1.0 "Console"
cordova-plugin-device 2.0.1 "Device"
cordova-plugin-whitelist 1.3.3 "Whitelist"
$ cordova platform
Installed platforms:
android 7.0.0
browser 5.0.3
Available platforms:
ios ~4.5.4
osx ~4.0.1
windows ~5.0.0
www ^3.12.0
$ npm -v
3.10.10
Here is how you update cordova for the project. This example assumes you are using android platform. If you have other plugins/platform, do the necessary.
npm install
npm update
cordova platform rm android --nosave
cordova platform add android
Alternatively
cordova platform update android
If you notice a specific plugin with version error, remove and the plugin with required version.

Error while trying to build apk of TensorFlow Android Camera Demo

I'm following this instruction for TensorFlow Android Camera Demo, I changed path for NDK and SDK in WORKSPACE and now when I'm trying to build APK, using command
$ bazel build //tensorflow/examples/android:tensorflow_demo
I got such errors:
What I'm doing wrong? How to fix it?
If I'm trying to build APK in Android Studio I get such Errors:
Error:/private/var/tmp/_bazel_Iryna/c541cf0f6f349cf0d7c8d3692096116a/external/protobuf/BUILD:73:1: C++ compilation of rule '#protobuf//:protobuf_lite' failed: sandbox-exec failed: error executing command /usr/bin/sandbox-exec -f /private/var/tmp/_bazel_Iryna/c541cf0f6f349cf0d7c8d3692096116a/bazel-sandbox/a0350092-17a0-44fc-a63c-6321732c52f4-2/sandbox.sb /bin/false -MD -MF ... (remaining 27 argument(s) skipped).
Error:Execution failed for task ':buildNative'.
> Process 'command '/usr/local/bin/bazel'' finished with non-zero exit value 1
This exact Error was caused by the fact, that I didn't uncomment path to NDK and SDK in WORKSPACE. For more details read here.

PhoneGap Build won't build for Android with PushPlugin

We have a PhoneGap app which refuses to build once we add in PushPlugin.
Specifically when using PhoneGap Build we get the error:
BUILD FAILED
/home/ec2-user/android-sdk/tools/ant/build.xml:573: ../../../../../../home/ec2-user/android-sdk/com.android.support:support-v4:+ resolve to a path with no project.properties file for project /project
We can occasionally get it to build using the Ripple emulator (building in Visual Studio) after updating PhoneGap ($ npm update -g phonegap) and the PhoneGap Android Platform ($ phonegap platform update android) to the latest versions.
We have included the plugin like this:
<gap:plugin name="com.phonegap.plugins.pushplugin" />
Or, when building in Visual Studio 2015:
<vs:plugin name="com.phonegap.plugins.PushPlugin" version="2.5.0" src="https://github.com/phonegap-build/PushPlugin.git" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps" />
Can anyone suggest where we might be going wrong?
EDIT:
We’ve also tried building on the command line, but even after installing cordova-plugin-android-support-v4, thus;
$ cordova plugin add cordova-plugin-android-support-v4
Fetching plugin "cordova-plugin-android-support-v4" via npm
npm http GET https://registry.npmjs.org/cordova-plugin-android-support-v4
npm http 200 https://registry.npmjs.org/cordova-plugin-android-support-v4
Installing "cordova-plugin-android-support-v4" for android
we still get errors:
C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1>cordova build android
Running command: cmd "/s /c "C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1\platforms\android\cordova\build.bat""
ANDROID_HOME=C:\Users\XXX\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files (x86)\java\jdk1.7.0_55
Running: C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1\platforms\android\gradlew cdvBuildDebug -b C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordova
dle.daemon=true
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find any version that matches com.android.support:support-v4:+.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml
https://repo1.maven.org/maven2/com/android/support/support-v4/
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: 2.897 secs
C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1\platforms\android\gradlew cdvBuildDebug -b C:\Dev\Cor
latforms\android\build.gradle -Dorg.gradle.daemon=true"
ERROR building one of the platforms: Error: cmd: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (C:\Users\XXX\AppData\Roaming\npm\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)
NEW Push Plugin released recently.
Read this (via the Offical Blog), and get the details:
http://simonmacdonald.blogspot.com/2015/07/phonegap-plugin-push-version-111.html
UPDATE (2015-10-24): According to the Phonegap Build blog of Sept 28, 2015
Android Builds Now Using Gradle By Default.
Ant is still available, and can be force into use - with <preference name="android-build-tool" value="ant" />
Other related changes occur, including automatic minSdkVersion versioning and validation of 9-patch images. Read the blog post for details.
NOTE: On your original problem, gradle (not officially supported by phonegap) is the problem. Some people have worked around this problem, by forcing ant to run in it's place. To find those other posts, search back 30 days from this post; the subjects are similar to this and included: "Failed to build".
For PhoneGap Build, use
<gap:plugin name="com.phonegap.plugins.pushplugin" version="2.4.0" /> to force it to use the older, supported, version.
Try removing the plugin and install it via command line using this command:
cordova plugin add com.phonegap.plugins.pushplugin --save
You will notice the plugin will show in your config.xml like this:
<plugin name="com.phonegap.plugins.PushPlugin" spec="^2.2.1" />
but it won't show on the config designer, for that to happen, add "vs:" in front of the plugin tag:
<vs:plugin name="com.phonegap.plugins.PushPlugin" spec="^2.2.1" />
Try this (not 100% work, but work for me).
remove this line in platforms/android/project.properties
cordova.system.library.1=com.android.support:support-v4:+
if you are using facebook plugin (like me), you can ignore below.
cordova plugin add android.support.v4

Categories

Resources