Quasar - Cordova Build for Android - android

I'm trying to export my quasar app for Android via cordova:
I ran into several issues an error which get to fix step by step. (Lots of mismatching Java and Android Versions.
Now I get this error with Gradle which I can't read anymore.
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/Users/jannofleischer/Library/Android/sdk (recommended setting)
ANDROID_HOME=/Users/jannofleischer/Library/Android/sdk (DEPRECATED)
Using Android SDK: /Users/jannofleischer/Library/Android/sdk
Subproject Path: CordovaLib
Subproject Path: app
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: unerwartetes Element (URI:"", lokal:"base-extension"). Erwartete Elemente sind <{}codename>,<{}layoutlib>,<{}api-level>
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 SUCCESSFUL in 572ms
48 actionable tasks: 48 up-to-date
Built the following apk(s):
/Users/jannofleischer/rubbellose/src-cordova/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/Users/jannofleischer/Library/Android/sdk (recommended setting)
ANDROID_HOME=/Users/jannofleischer/Library/Android/sdk (DEPRECATED)
Using Android SDK: /Users/jannofleischer/Library/Android/sdk
Command failed with exit code 1: apkanalyzer manifest target-sdk /Users/jannofleischer/rubbellose/src-cordova/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.tools.apk.analyzer.ApkAnalyzerCli.getAaptInvokerFromSdk(ApkAnalyzerCli.java:277)
at com.android.tools.apk.analyzer.ApkAnalyzerCli.main(ApkAnalyzerCli.java:129)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
App • Command "cordova" failed with exit code: 1
App • Updated Cordova config.xml
App • ⚠️ FAIL Cordova CLI has failed
Anyone has a hint what's causing this error or how I can make use of the --warning-mode all option?
Operating System is MacOS by the way (M1 ARM Chip, if that matters)

i have same problem and finally fixed for me. u can change version of the Gradle and JDK from project structure (using Android Studio / File Menu) this tutorial can be help.
So for resolve the problem u can use this tutorial, note that Gradle version must be compatible with jdk version.
Links
Gradle Release Notes:
https://docs.gradle.org/7.3/release-notes.html
Java and Gradle Compatibility Matrix: docs.gradle.org/current/userguide/compatibility.html#java
Compatibility Example
Java (JDK): jdk-18.0.2.1
Gradle: 7.5
Embedded Kotlin version: 1.6.21
Kotlin Language version: 1.4
Enviroments
Windows:
setx ANDROID_HOME "%USERPROFILE%\AppData\Local\Android\Sdk"
setx ANDROID_SDK_ROOT "%USERPROFILE%\AppData\Local\Android\Sdk"
setx JAVA_HOME "C:\Program Files\Java\jdk-18.0.2.1"
setx path "%path%;%ANDROID_SDK_ROOT%\tools;%ANDROID_SDK_ROOT%\platform-tools;"
Unix (macOS, linux):
export ANDROID_HOME="$HOME/Android/Sdk"
export ANDROID_SDK_ROOT="$HOME/Android/Sdk"
export JAVA_HOME="{{path to java}}/jdk-18.0.2.1"
export PATH=$PATH:$ANDROID_SDK_ROOT/tools;
PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
cordova requirements
Requirements check results for android:
Java JDK: installed 18.0.2
Android SDK: installed true
Android target: installed android-32,android-31,android-30,android-29,android-28,android-27,android-26,android-25,android-24,Google Inc.:Google APIs:24,android-17,android-15,android-7
Gradle: installed C:\Users#myuserprofile#\AppData\Local\Android\Sdk\gradle-7.5\bin\gradle.BAT
After Build (Result):
BUILD SUCCESSFUL in 19s
52 actionable tasks: 52 executed

Related

Android verifyReleaseResources fails, resource not found

verifyReleaseResources keeps failing for my android assembleRelease build.
A description of my react-native build
System:
OS: macOS 12.6
CPU: (10) x64 Apple M1 Max
Memory: 22.59 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 14.19.1 - ~/.nvm/versions/node/v14.19.1/bin/node
Yarn: 1.22.18 - ~/github/snackpass/snackpass-client/node_modules/.bin/yarn
npm: 8.19.2 - /opt/homebrew/bin/npm
Watchman: 2022.10.31.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: Dolphin 2021.3.1 Patch 1 Dolphin 2021.3.1 Patch 1
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /Users/alitamoore/.jenv/shims/javac
npmPackages:
#react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: ^0.64.4 => 0.64.4
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Here’re some sample errors I got
(Warning/Error) Argfile not found
Argfile not found: /Users/alitamoore/Library/Application Support/kotlin/daemon/promotedai_react-native-metrics_release
(error) Incompatible kotlin version
/Users/alitamoore/.gradle/caches/transforms-3/39d9fb5957939f0b72af860a8de1b4e0/transformed/jetified-kotlin-stdlib-jdk7-1.6.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
/Users/alitamoore/.gradle/caches/transforms-3/556bb75edc66f947ffbea3dd348ad797/transformed/jetified-kotlin-stdlib-common-1.6.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
/Users/alitamoore/.gradle/caches/transforms-3/572b2229271f904a5c21007cf91f4994/transformed/jetified-react-native-0.71.0-rc.0-release-api.jar!/META-INF/ReactAndroid_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
/Users/alitamoore/.gradle/caches/transforms-3/687b7f7119d3db63f03c30ceb978b8e7/transformed/jetified-kotlin-stdlib-1.6.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
/Users/alitamoore/.gradle/caches/transforms-3/b89184fd2243c0ba9c21f04aac02ee1a/transformed/jetified-kotlin-stdlib-jdk8-1.6.10.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
If I force the kotlin version the dependency to 1.6.0 then I get another error
(Error) failed linking file resources
Execution failed for task ':promotedai_react-native-metrics:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
AAPT: /Users/alitamoore/github/snackpass/snackpass-client/node_modules/#promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:18: error: resource attr/autofillInlineSuggestionChip (aka ai.promoted:attr/autofillInlineSuggestionChip) not found.
/Users/alitamoore/github/snackpass/snackpass-client/node_modules/#promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:25: error: resource attr/autofillInlineSuggestionStartIconStyle (aka ai.promoted:attr/autofillInlineSuggestionStartIconStyle) not found.
/Users/alitamoore/github/snackpass/snackpass-client/node_modules/#promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:32: error: resource attr/autofillInlineSuggestionTitle (aka ai.promoted:attr/autofillInlineSuggestionTitle) not found.
/Users/alitamoore/github/snackpass/snackpass-client/node_modules/#promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:41: error: resource attr/autofillInlineSuggestionSubtitle (aka ai.promoted:attr/autofillInlineSuggestionSubtitle) not found.
/Users/alitamoore/github/snackpass/snackpass-client/node_modules/#promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:50: error: resource attr/autofillInlineSuggestionEndIconStyle (aka ai.promoted:attr/autofillInlineSuggestionEndIconStyle) not found.
error: failed linking file resources.
This error is also unpredictable, sometimes after clearing cache it passes the build.
I don’t know why this happens, exactly. But I do know that removing the offending linked packages (note that links only apply RN < 0.69.0) from android/settings.gradle fixes it.
e.g. remove these lines (in the example given)
include ':#promotedai_react-native-metrics'
project(':#promotedai_react-native-metrics').projectDir = new File(rootProject.projectDir, '../node_modules/#promotedai/react-native-metrics/android')
While I was debugging this, I also found some useful solutions to the errors mentioned. They may be useful:
Argfile not found
Try
cd android
./gradlew clean
Incompatible Kotlin Version
If you notice in the above errors it says The binary version of its metadata is 1.6.0, expected version is 1.1.15 but 1.1.15 is not a valid version of Kotlin. So if you override that with a valid version it’ll fix the issue. Try applying it project wide first (android/build.gradle)
buildScript {
ext {
kotlinVersion = “1.6.0”
}
}
If that has issues, then you can override it directly in the dependency and then save those changes with patch-package
failed linking file resources
In some cases you may see error: resource android:attr/lStar not found. In that case, see Saurabh’s suggestion or this video I found useful.

Warning when flutter build apk command entered

When I run Flutter build apk command the terminal gives me a warning. But apk file generated successfully. Do you have any idea to how to solve this warning?
Here is my terminal output:
Building with sound null safety
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01Running Gradle task 'assembleRelease'... 103.1s
√ Built build\app\outputs\flutter-apk\app-release.apk (16.3MB).
Just update the Android Gradle Plugin version from 4.1.0 to 7.0.2 using new android

Error compiling cocos2d-x v3.10 project

I'm trying to compile a new project on cmd using cocos2d-x v3.10, but the build is failing and I'm getting the following error:
The output as seen on cmd.
-pre-compile:
-compile:
[javac] Compiling 29 source files to D:\Varun\MyApp\MyApp\cocos2d\cocos\platform
\android\java\bin\classes
[javac] error: error reading D:\Varun\MyApp\MyApp\cocos2d\cocos\platform\android
\java\libs\._android-async-http-1.4.8.jar; error in opening zip file
[javac] warning: [options] source value 1.5 is obsolete and will be removed
in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed
in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use
-Xlint:-options.
[javac] 1 error
[javac] 3 warnings
BUILD FAILED
D:\adt-bundle-windows-x86_64-20140321\sdk\tools\ant\build.xml:601: The following
error occurred while executing this line:
D:\adt-bundle-windows-x86_64-20140321\sdk\tools\ant\build.xml:720: The following
error occurred while executing this line:
D:\adt-bundle-windows-x86_64-20140321\sdk\tools\ant\build.xml:734: Compile faile
d; see the compiler error output for details.
Total time: 2 seconds
Error running command, return code: 1.
I'm using the following:
JDK: 1.8.0_73
Android api: 19
NDK: r9
Ant: 1.9.6
Python: 2.7.11
I think ._android-async-http-1.4.8.jar is a hidden file or the file is corrupted.
For case one, just rename it to android-async-http-1.4.8.jar and refer it to again.
For case two, just download a new one.

crosswalk project build for android failed

I'm trying to build android app using Crosswalk. I followed this official guideto set up.
And succeed in building example project. But after when I try to build from my own HTML5 project, it builds failed.
ERROR Outputs:
Starting application build (arm)
* Checking keystore for signing
No keystore provided for signing. Using xwalk's keystore for debugging.
Please use a valid keystore when distributing to the app market.
* Updating project with xwalk_core_library
* Checking for external extensions
* Copying native libraries for arm
* Building Android apk package with Crosswalk embedded (arm)
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] 3 warnings
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] 3 warnings
BUILD FAILED
/home/jian/app/android-sdk-linux/tools/ant/build.xml:928: The following error occurred while executing this line:
/home/jian/app/android-sdk-linux/tools/ant/build.xml:946: null returned: 1
Total time: 40 seconds
Command "/home/jian/app/ant/bin/ant release -f /tmp/Threecakes-Qqo589/build.xml -Dkey.store=/home/jian/app/crosswalk-14.43.343.17/xwalk-debug.keystore -Dkey.alias=xwalkdebugkey -Dkey.store.password=xwalkdebug -Dkey.alias.password=xwalkdebug" exited with non-zero exit code 1
This is my environment setting:
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export ANDROID_HOME=/home/jian/app/android-sdk-linux
export ANT_HOME=/home/jian/app/ant
export PATH=/home/jian/app/ant/bin:/usr/lib/jvm/java-8-oracle/bin:$PATH
export PATH=/home/jian/app/android-sdk-linux:$PATH
export PATH=/home/jian/app/android-sdk-linux/tools:$PATH
export PATH=/home/jian/app/android-sdk-linux/platform-tools:$PATH
This is version information:
java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
ant -version
Apache Ant(TM) version 1.9.6 compiled on June 29 2015
adb help
Android Debug Bridge version 1.0.32
crosswalk version
14.43.343.17
And This is part of ant/build.xml where the error occured.
<target name="-package-resources" depends="-crunch">
<!-- only package resources if *not* a library project -->
<do-only-if-not-library elseText="Library project: do not package resources..." >
<aapt executable="${aapt}"
command="package"
versioncode="${version.code}"
versionname="${version.name}"
debug="${build.is.packaging.debug}"
manifest="${out.manifest.abs.file}"
assets="${asset.absolute.dir}"
androidjar="${project.target.android.jar}"
apkfolder="${out.absolute.dir}"
nocrunch="${build.packaging.nocrunch}"
resourcefilename="${resource.package.file.name}"
resourcefilter="${aapt.resource.filter}"
libraryResFolderPathRefid="project.library.res.folder.path"
libraryPackagesRefid="project.library.packages"
libraryRFileRefid="project.library.bin.r.file.path"
previousBuildType="${build.last.target}"
buildType="${build.target}"
ignoreAssets="${aapt.ignore.assets}">
<res path="${out.res.absolute.dir}" />
<res path="${resource.absolute.dir}" />
<!-- <nocompress /> forces no compression on any files in assets or res/raw -->
<!-- <nocompress extension="xml" /> forces no compression on specific file extensions in assets and res/raw -->
</aapt>
</do-only-if-not-library>
</target>
Why I succeed in building example project but failed to building my own project? And how do I fix this error. Thank you for your help!
I had the same problem.
I downgrade version of Java to fix it :
java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
You can report your issue to https://crosswalk-project.org/jira/browse/ to get faster response from Crosswalk developer.

unable to build my app

Hi World App is running in simulator but not generating the BUILD files.
I am getting this error
goBlank:
testFail:
setupJavac:
jar:
[echo] Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller
[echo] code size and wider device support
[copy] Copying 1 file to E:\rainforest\rfl1\rfl1-1\testcodenameone\build\tmp
[javac] E:\rainforest\rfl1\rfl1-1\testcodenameone\build.xml:131: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 3 source files to E:\rainforest\rfl1\rfl1-1\testcodenameone\build\tmp
[jar] Building jar: E:\rainforest\rfl1\rfl1-1\testcodenameone\dist\testcodenameone.jar
[javac] E:\rainforest\rfl1\rfl1-1\testcodenameone\build.xml:155: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
BUILD FAILED
E:\rainforest\rfl1\rfl1-1\testcodenameone\build.xml:155: Class not found: javac1.8
Total time: 3 seconds
You need Eclipse itself to run under JDK 1.7 (this needs to be configured via the Eclipse ini file). Also make sure JAVA_HOME points to JDK 1.7.

Categories

Resources