Although this question has been asked by others, none of the provided solutions work for my use case.
Environment
System:
OS: macOS 12.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 202.25 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.1.0 - ~/.nvm/versions/node/v16.1.0/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 7.11.2 - ~/.nvm/versions/node/v16.1.0/bin/npm
Watchman: 2022.03.21.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: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.15 - /Users/AH94896/.jenv/shims/javac (Using Java 1.8 gives same result)
npmPackages:
#react-native-community/cli: Not Found
react: 16.14.0 => 16.14.0
react-native: 0.64.1 => 0.64.1
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
------------------------------------------------------------
Gradle 6.5.1
------------------------------------------------------------
Build time: 2020-06-30 06:32:47 UTC
Revision: 66bc713f7169626a7f0134bf452abde51550ea0a
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 11.0.15 (Eclipse Adoptium 11.0.15+10)
OS: Mac OS X 12.3.1 x86_64
Description
I can clean the app using ./gradlew clean. But when launching using npx react-native run-android, the build fails in the same spot:
> Configure project :react-native-reanimated
No AAR for react-native-reanimated found. Attempting to build from source.
Native libs debug enabled: false
Android gradle plugin: 4.1.0
Gradle: 6.5.1
building Reanimated2
> Task :react-native-reanimated:compileDebugJavaWithJavac FAILED
The place in the build process where it goes awry is this
/Users/AH94896/projects/app/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java:13: error: cannot find symbol
ViewManagerResolver viewManagerResolver,
^
symbol: class ViewManagerResolver
location: class ReanimatedUIImplementation
/Users/AH94896/projects/app/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java:11: error: recursive constructor invocation
public ReanimatedUIImplementation(
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-reanimated:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
The REALLY odd fact is that NO ONE else on my team experiences this problem whether using Apple M1 or Intel Macs. I have exhausted every resource I've found searching for a solution.
Please ask if you need more info. This is a critical blocker for my project work.
Related
I am new to react-native and I have to do the support on an app.
I can’t compile it on Android. I get an error while building it either by command line or from the android studio.
My configuration :
$ react-native info
info Fetching system and libraries information...
(node:21418) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
System:
OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 # 3.00GHz
Memory: 228.16 MB / 7.68 GB
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 14.21.2 - ~/.nvm/versions/node/v14.21.2/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v14.21.2/bin/yarn
npm: 6.14.17 - ~/.nvm/versions/node/v14.21.2/bin/npm
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 30, 33, 33
Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0, 33.0.1
System Images: android-30 | Google APIs Intel x86 Atom, android-33 | Google APIs Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: AI-213.7172.25.2113.9123335
Languages:
Java: 11.0.17 - /lib/jvm/java-1.11.0-openjdk-amd64/bin/javac
npmPackages:
#react-native-community/cli: ^10.1.0 => 10.1.0
react: ^18.1.0 => 18.2.0
react-native: 0.70.6 => 0.70.6
npmGlobalPackages:
*react-native*: Not Found
The command line :
react-native run-android --variant=stagingDebug --appId com.< app name>.staging
Error that I get :
> Task :app:compileStagingDebugJavaWithJavac FAILED
359 actionable tasks: 6 executed, 353 up-to-date
<myProject root path>/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:99: error: package com.< app name>.staging does not exist
new CodePush(com.< app name>.staging.BuildConfig.CODEPUSH_KEY, this.getApplication(), com.< app name>.staging.BuildConfig.DEBUG),
react-native.config.js :
module.exports = {
dependencies: {
// disable autolinking for these unsupported libraries
// #codepush
'react-native-code-push': {
platforms: {
android: {
packageImportPath: 'import com.microsoft.codepush.react.CodePush;',
packageInstance:
'new CodePush(BuildConfig.CODEPUSH_KEY, this.getApplication(), BuildConfig.DEBUG)',
},
},
},
},
};
I hope someone can help me!
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.
I have a project that compiles fine when I run ANDROID_HOME=/.../Library/Android/sdk gradle clean assembleDebug. But when I try to run the same on a github action like this...
on:
push:
branches:
- '**'
jobs:
test:
name: Analyze Android
runs-on: ubuntu-latest
steps:
- name: Checkout App
uses: actions/checkout#v2
- uses: actions/setup-java#v3
with:
distribution: temurin
java-version: 11
- name: Setup Gradle
uses: gradle/gradle-build-action#v2
- name: Setup Android SDK
uses: android-actions/setup-android#v2
- name: Assemble
run: |
./gradlew clean assembleDebug
I get
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :DTO.
Required by:
project :app
project :app > project :UI
project :app > project :Data
project :app > project :Domain
> No matching configuration of project :DTO was found. The consumer was configured to find a runtime of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.2.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
- None of the consumable configurations have attributes.
But the DTO project does exist and as I said works locally. I checked the versions and they look to be the same...
------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------
Build time: 2022-08-05 21:17:56 UTC
Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918
Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 15.0.2 (Oracle Corporation 15.0.2+7-27)
OS: Mac OS X 10.16 x86_64
------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------
Build time: 2022-08-05 21:17:56 UTC
Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918
Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.16 (Eclipse Adoptium 11.0.16+8)
OS: Linux 5.15.0-1014-azure amd64
Why does it work locally but not via Github Actions?
Updates
It looks like it is because the library is setup like this...
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
}
instead of like the rest...
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}
So it finds the others but not this one. But I tried converting to an android app and I get the same issue.
In my case it was because my local box was OSX (not case sensitive) and the build box was Ubuntu (case sensitive). Once the name was lowercased it worked.
I think your computer doesn't have enough space(RAM) for Build. I also faced the similar issue but it got resolved when I Increased my internal ram.
i just started using my new M1 mac , environment setup done completely . while trying to sync project with Gradle i am getting following error :
Null extracted folder for artifact: ResolvedArtifact(componentIdentifier=com.facebook.react:react-native:0.66.4, variantName=null
and here is my env info :
System:
OS: macOS 12.5
CPU: (10) arm64 Apple M1 Max
Memory: 26.88 GB / 64.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.6.0 - /opt/homebrew/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.16.0 - /opt/homebrew/bin/npm
Watchman: 2022.07.04.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: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.16 - /usr/bin/javac
npmPackages:
#react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.66.4 => 0.66.4
and when i run through npx react-native run-android i got the following error:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform react-native-0.66.4.aar (com.facebook.react:react-native:0.66.4) to match attributes {artifactType=android-aar-metadata, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for ExtractAarTransform: /Users/username/project'sfolder/node_modules/react-native/android/com/facebook/react/react-native/0.66.4/react-native-0.66.4.aar.
> Unexpected end of ZLIB input stream
Development Environment
System:
OS: macOS 10.15.4
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU # 2.20GHz
Memory: 248.71 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 13.2.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK: Not Found
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5900203
Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
Languages:
Java: 13.0.1 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
#react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
I am not able to make PDF in ANDROID API LEVEL 29. It is working fine in API LEVEL 28.
So I downgraded RN version from 0.63.2 from 0.62.2 and Gradle 3.5.3 to 3.5.2
according to this issue https://github.com/christopherdro/react-native-html-to-pdf/issues/189
also followed https://github.com/christopherdro/react-native-html-to-pdf/issues/149
this too. It says Permission error so inside componentDidMount() I have added following line
PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE)
But still no luck.
I am getting following error.
Possible Unhandled Promise Rejection (id: 0):
Error: RNHTMLtoPDF error: Could not create folder structure.
promiseMethodWrapper#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2214:45
createPDF$#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:136885:88
tryCatch#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26640:23
invoke#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26813:32
tryCatch#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26640:23
invoke#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26713:30
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26743:19
tryCallTwo#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:28610:9
doResolve#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:28774:25
Promise#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:28633:14
callInvokeWithMethodAndArg#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26742:33
enqueue#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26747:157
async#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26764:69
createPDF#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:136851:42
requestReadPermission$#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:136835:33
tryCatch#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26640:23
invoke#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26813:32
tryCatch#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26640:23
invoke#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26713:30
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26723:21
tryCallOne#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:28601:16
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:28702:27
_callTimer#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:32141:17
_callImmediatesPass#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:32177:19
callImmediates#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:32395:33
callImmediates#[native code]
__callImmediates#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2719:35
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2505:34
__guard#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2702:15
flushedQueue#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2504:21
flushedQueue#[native code]
invokeCallbackAndReturnFlushedQueue#[native code]
This is library which I am using https://github.com/christopherdro/react-native-html-to-pdf
I found solution from this link
If you find out that your app is not able to make any file or folder you should add
android:requestLegacyExternalStorage="true" in your `<application>` in `AndroidManifest.xml`
for more details Official Link and Other StackOverflow Question Answsers
Remember: I am using React Native and only in Android API 29 and above I stuck in this issue.
I was also facing that problem, after some researching, I solve that problem,
"Directory name must be same as the directory(folder) present in you device, if you want to make custom directory then it may or may not work in you device because of the file structure or some native permission if custom directory name not work then you have to specify 'Documents' or 'Download' at directory option"
Note:
Example:
async createPDF() {
let options = {
html: '<h1>Export PDF</h1>',
fileName: 'MyPdf',
directory: 'Documents', //or Download
};
let file = await RNHTMLtoPDF.convert(options)
alert(file.filePath);
}