Meteor APK build broken with accounts-google - android

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.

Related

Can't build apk in react native

I have a task to build apk applications with react native, I watched this video to understand how to do it and took the same code
https://www.youtube.com/watch?v=5tgcogEoIiQ&t=590s
https://github.com/mahdi-sharifimehr/RN-Tutorial-Main/tree/RN-Tutorial-35
I got such an error:
> Task :app:processDebugManifest FAILED
Type 'ProcessApplicationManifest': static method 'getArtifactName()' should not be annotated with: #Internal. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.2/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
Type 'ProcessApplicationManifest': static method 'getNameFromAutoNamespacedManifest()' should not be annotated with: #Internal. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.2/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
/root/escrow_checker/apps/RN-Tutorial-Main-RN-Tutorial-35/android/app/src/debug/AndroidManifest.xml Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [com.facebook.react:react-native:0.71.0-rc.0] /root/.gradle/caches/transforms-2/files-2.1/af47c244ab2af63c65c98f6eb4516ef2/jetified-react-native-0.71.0-rc.0-debug/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="com.facebook.react" to force usage (may lead to runtime failures)
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [com.facebook.react:react-native:0.71.0-rc.0] /root/.gradle/caches/transforms-2/files-2.1/af47c244ab2af63c65c98f6eb4516ef2/jetified-react-native-0.71.0-rc.0-debug/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="com.facebook.react" to force usage (may lead to runtime failures)
* 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 19s
found a solution on the Internet and changed minSdkVersion in build.gradle to 23, but now I get such an error:
> Task :app:processDebugResources FAILED
Type 'LinkApplicationAndroidResourcesTask': non-property method 'canHaveSplits()' should not be annotated with: #Input. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.2/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/root/.gradle/caches/transforms-2/files-2.1/991cf6dc746cd39d23cce3c15a61bfa7/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.
please tell me what's wrong and why I can't easily build the apk, here are my actions
in main directory
npm install
cd android
chmod +x ./gradlew
./gradlew assembleDebug
Gradle version Gradle 7.4.2
I don’t understand why it doesn’t want to build, in theory I should have got apk
" uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library "
Looks like your minSdkVersion isn't compatible with your facebook library you're using. What kind of React Native project are you using?
If it's expo managed you'll need this: https://docs.expo.dev/versions/latest/sdk/build-properties/
If it's a non-expo project, you can easily go into the Android files on your own. This link will help you: How to specify the minSdkVersion in react native project
It's likely that you just need to change the 16 to a 21 and it'll build.

FAILURE: Build failed with an exception. - Android

AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{}],"original":"ERROR:: AAPT: D:\android-basics-kotlin-cupcake-app-starter\app\build\intermediates\processed_res\debug\out\resources-debug.ap_: error: The system cannot find the file specified. (2).\nerror: failed to create archive.\n\n ","tool":"AAPT"}
Task :app:mergeDebugNativeLibs
Task :app:mergeExtDexDebug
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
Android resource linking failed
ERROR:: AAPT: D:\android-basics-kotlin-cupcake-app-starter\app\build\intermediates\processed_res\debug\out\resources-debug.ap_: error: The system cannot find the file specified. (2).
error: failed to create archive.
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 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 7s
27 actionable tasks: 26 executed, 1 up-to-date
Can anyone help me to solve this problem...? please...
This is what happens when aapt fails to create an archive.
First make sure you are using the latest IDE and SDK. aapt for packaging is obsolete, and the earlier aapt2 has many bugs.
If they are up to date, try to check if the following processes on your computer have read/write access to the project directory.
[your android sdk path]\build-tools[your sdk version]\aapt.exe
[your android sdk path]\build-tools[your sdk version]\aapt2.exe
[your android studio path]\bin\studio64.exe
[your android studio path]\bin\fsnotifier64.exe
[your android studio path]\jre\bin\java.exe
[your android studio path]\jre\bin\javaw.exe
If you haven't set permissions manually, they are usually blocked by security software.
I recently ran into this problem and spent a lot of time finally found out that the security software on my workstation was not adding aapt2 and aapt to the allowed list for the project repository.

Cordova build android:':app:mergeDebugResources'. failing in Jenkins

After updating the android studio, gradle version and Cordova (incl. platforms) for hybrid project in windows 10 recently, i got this error in Jenkins.
:app:mergeDebugResourcesC:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.4.0.aar\76d6a769daf730ed767830374ebcd3bd\res\drawable\abc_btn_colored_material.xml: error: file not found.
...
...
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I searched for a solution for this which should be dynamical and can be managed through Jenkins itself since it is not possible to edit individual platform files.
Originally the error was
Execution failed for task ':mergeDebugResources'.
> Error: com.android.builder.internal.aapt.AaptException: Failed to crunch file
which was caused by
Error: File path too long on windows, keep below 240 characters
Workaround for this was to change workspace folder so it is coming to a top level. (eg: C:/Users/[youruser]/yourfolder. Check the link here
Note
I added this question and the answer, for the self reference in future and to assist someone who is working with Jenkins.
The answer is a simple tweak. Go to
Manage Jenkins --> Configure System --> Global Properties
add an Environment variable
name = GRADLE_USER_HOME
value = C:\Users\[youruser]\devGradle
create a folder "devGradle" (or give it any name) if it is not created already.
The Gradle build script will look for this environment variable and then use the specified directory as the Gradle home directory and will build the project

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.

Android Build failed after adding Crosswalk to Ionic

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.

Categories

Resources