In my expo project I am getting below error -
Getting error -
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:mergeProdMinSdkProdKernelReleaseResources'.
[stderr] > Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error:
check logs for details
[stderr] * Try:
[stderr] Run with
[stderr] --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.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 6m 45s
690 actionable tasks: 690 executed
Error: Process exited with non-zero code: 1
at ChildProcess.child.on (/app/node_modules/xdl/node_modules/#expo/spawn-async/build/spawnAsync.js:39:21)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:915:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
app.json
{
"expo":{
"name":"YYY",
"slug":"YYY",
"scheme":"yyy",
"sdkVersion":"31.0.0",
"icon":"./assets/icon.png",
"version":"1.0.0",
"platforms":[
"ios",
"android"
],
"orientation":"portrait",
"primaryColor":"#cccccc",
"packagerOpts":{
"assetExts":[
"ttf"
]
},
"android":{
"package":"com.xxyy.xxyy",
"splash":{
"backgroundColor":"#ffffff",
"ldpi":"./assets/splash.png",
"mdpi":"./assets/mdpi/splash.png",
"hdpi":"./assets/hdpi/splash.png",
"xhdpi":"./assets/xhdpi/splash.png",
"xxhdpi":"./assets/xxhdpi/splash.png",
"xxxhdpi":"./assets/xxxhdpi/splash.png",
"resizeMode":"cover"
}
},
"ios":{
"bundleIdentifier":"com.xxy.yyz",
"splash":{
"backgroundColor":"#ffffff",
"resizeMode":"cover",
"image":"./assets/ios/splash#2x.png",
"tabletImage":"./assets/ios/splash.png"
}
},
"androidStatusBarColor":"#334393",
"androidStatusBar":{
"barStyle":"light-content",
"backgroundColor":"#334393"
},
"description":""
}
}
Related
I have resumed a project that I started a few months ago, an app that I am building in react native. The problem is that when going to compile it told me that I had to update to eas. I have updated and now when trying to do a build it tells me:
[stderr] FAILURE: Build completed with 2 failures.
[stderr] 1: Task failed with an exception.
[stderr] -----------
[stderr] * Where:
[stderr] Build file '/home/expo/workingdir/build/node_modules/#unimodules/core/android/build.gradle' line: 3
[stderr] * What went wrong:
[stderr] A problem occurred evaluating project ':unimodules-core'.
[stderr] > Plugin with id 'maven' not found.
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] ==============================================================================
[stderr] 2: Task failed with an exception.
[stderr] -----------
[stderr] * What went wrong:
[stderr] A problem occurred configuring project ':expo'.
[stderr] >
[stderr] compileSdkVersion is not specified. Please add it to build.gradle
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] ==============================================================================
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 1m 43s
my code in build.gradle is the following (I've already changed the maven call to maven-publish but it's still the same):
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
group = 'org.unimodules'
version = '6.7.1'
buildscript {
// Simple helper that allows the root project to override versions declared by this library.
ext.safeExtGet = { prop, fallback ->
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:6.7.1'
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.4.21')}")
}
}
//Upload android library to maven with javadoc and android sources
configurations {
deployerJars
}
//Creating sources with comments
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
//Put the androidSources and javadoc to the artifacts
artifacts {
archives androidSourcesJar
}
uploadArchives {
repositories {
mavenDeployer {
configuration = configurations.deployerJars
repository(url: mavenLocal().url)
}
}
}
android {
compileSdkVersion safeExtGet("compileSdkVersion", 30)
buildToolsVersion safeExtGet("buildToolsVersion", 30)
minSdkVersion safeExtGet("minSdkVersion", 21)
targetSdkVersion safeExtGet("targetSdkVersion", 21)
buildToolsVersion "30.0.1"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
compileSdkVersion 30
minSdkVersion safeExtGet("minSdkVersion", 21)
targetSdkVersion safeExtGet("targetSdkVersion", 30)
consumerProguardFiles 'proguard-rules.pro'
versionCode 20
versionName "7.1.2"
minSdkVersion 21
targetSdkVersion 30
buildToolsVersion "30.0.1"
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.4.21')}"
}
Do you know how I can solve it? Thanks.
When I try to build my expo react native app using expo EAS services I get this error as follows,
Please consult deprecation warnings for more details.
426 actionable tasks: 426 executed
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:bundleReleaseJsAndAssets'.
[stderr] > Process 'command 'node'' finished with non-zero exit value 1
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 3m 8s
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
my eas.json looks like this,
{
"cli": {
"version": ">= 2.4.1"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal",
"android": {
"image": "ubuntu-18.04-jdk-11-ndk-r19c"
}
},
"preview": {
"distribution": "internal"
},
"production": {
"android": {
"buildType": "apk"
}
}
},
"submit": {
"production": {}
}
}
my app configuration is as follows,
minSdkVersion = '21'
buildToolsVersion = '31.0.0'
compileSdkVersion = '33'
targetSdkVersion = '33'
I'm trying to generate an apk here.
Can someone help, please
The real cause of the issue should be logged somewhere above
I'm trying to migrate to using eas-build from expo build. I created a simple eas.json and I'm stuck on fixing this (hopefully) last error.
I didn't have a .env file before moving to eas-build so I'm quite sure that's not the issue.
package.json snippet:
"expo": "^41.0.0",
"react": "17.0.2",
"react-native": "0.63.4",
And my eas.json:
{
"cli": {
"version": ">= 2.1.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal",
"android": {
"buildType": "apk"
}
},
"production": {}
},
"submit": {
"production": {}
}
}
The error I'm getting in the "run gradlew" step on Expo:
> Task :app:createReleaseExpoConfig FAILED
[stderr] node:internal/modules/cjs/loader:936
[stderr] throw err;
[stderr] ^
[stderr] Error: Cannot find module 'jsonfile/utils'
[stderr] Require stack:
[stderr] - /home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/configure-splash-screen/node_modules/fs-extra/lib/json/output-json.js
[stderr] - /home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/configure-splash-screen/node_modules/fs-extra/lib/json/index.js
[stderr] - /home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/configure-splash-screen/node_modules/fs-extra/lib/index.js
[stderr] - /home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/configure-splash-screen/build/ios/index.js
[stderr] - /home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/configure-splash-screen/build/index.js
[stderr] - /home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/config-plugins/build/android/SplashScreen.js
[stderr] - /home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/config-plugins/build/android/index.js
[stderr] - /home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/config-plugins/build/index.js
[stderr] - /home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/config/build/plugins/withConfigPlugins.js
[stderr] - /home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/config/build/Config.js
[stderr] - /home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/config/build/index.js
[stderr] - /home/expo/workingdir/build/node_modules/expo-constants/scripts/getAppConfig.js
[stderr] at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
[stderr] at Function.Module._load (node:internal/modules/cjs/loader:778:27)
[stderr] at Module.require (node:internal/modules/cjs/loader:1005:19)
[stderr] at require (node:internal/modules/cjs/helpers:102:18)
[stderr] at Object.<anonymous> (/home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/configure-splash-screen/node_modules/fs-extra/lib/json/output-json.js:3:23)
[stderr] at Module._compile (node:internal/modules/cjs/loader:1101:14)
[stderr] at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
[stderr] at Module.load (node:internal/modules/cjs/loader:981:32)
[stderr] at Function.Module._load (node:internal/modules/cjs/loader:822:12)
[stderr] at Module.require (node:internal/modules/cjs/loader:1005:19) {
[stderr] code: 'MODULE_NOT_FOUND',
[stderr] requireStack: [
[stderr] '/home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/configure-splash-screen/node_modules/fs-extra/lib/json/output-json.js',
[stderr] '/home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/configure-splash-screen/node_modules/fs-extra/lib/json/index.js',
[stderr] '/home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/configure-splash-screen/node_modules/fs-extra/lib/index.js',
[stderr] '/home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/configure-splash-screen/build/ios/index.js',
[stderr] '/home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/configure-splash-screen/build/index.js',
[stderr] '/home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/config-plugins/build/android/SplashScreen.js',
[stderr] '/home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/config-plugins/build/android/index.js',
[stderr] '/home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/config-plugins/build/index.js',
[stderr] '/home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/config/build/plugins/withConfigPlugins.js',
[stderr] '/home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/config/build/Config.js',
[stderr] '/home/expo/workingdir/build/node_modules/expo-constants/node_modules/#expo/config/build/index.js',
[stderr] '/home/expo/workingdir/build/node_modules/expo-constants/scripts/getAppConfig.js'
[stderr] ]
[stderr] }
> Task :unimodules-permissions-interface:packageReleaseResources
> Task :unimodules-image-loader-interface:packageReleaseResources
> Task :unimodules-react-native-adapter:packageReleaseResources
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:createReleaseExpoConfig'.
[stderr] > Process 'command 'node'' finished with non-zero exit value 1
[stderr] * Try:
[stderr] 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.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 2m 16s
Your expo SDK is deprecated (SDK 41), which can cause a lot of problems when building with eas.
A lot of times this issue is resolved by upgrading your SDK to a non-deprecated expo SDK version.
Follow the instructions on upgrading your SDK and run eas build -p android --profile development or eas build -p android --profile preview
Upgrading Expo SDK
I am facing this error after installing react-native-code-push.
Task :app:generateBundledResourcesHashRelease FAILED
internal/fs/utils.js:230
throw err;
^
Error: ENOENT: no such file or directory, scandir '/home/ayush/Desktop/awsproject/android/app/build/generated/res/react/release'
at Object.readdirSync (fs.js:872:3)
at getFilesInFolder (/home/ayush/Desktop/awsproject/node_modules/react-native-code-push/scripts/getFilesInFolder.js:7:26)
at Object.<anonymous> (/home/ayush/Desktop/awsproject/node_modules/react-native-code-push/scripts/generateBundledResourcesHash.js:38:1)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
errno: -2,
syscall: 'scandir',
code: 'ENOENT',
path: '/home/ayush/Desktop/awsproject/android/app/build/generated/res/react/release'
}
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:generateBundledResourcesHashRelease'.
> Process 'command 'node'' finished with non-zero exit value 1
* 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.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 36s
52 actionable tasks: 52 executed
go to node_modules/react-native-code-push/android/codepush.gradle
It appears that the only change needed to make this work is to add 2 mkdirs() calls to the codepush gradle task, like so:
//...
if (variant.hasProperty("bundleJsAndAssets")) {z
def reactBundleTask = variant.bundleJsAndAssets
jsBundleDir = reactBundleTask.generatedAssetsFolders[0].absolutePath
resourcesDir = reactBundleTask.generatedResFolders[0].absolutePath
//add these 2 lines
new File(jsBundleDir).mkdirs()
new File(resourcesDir).mkdirs()
jsBundleFile = file("$jsBundleDir/$bundleAssetName")
//...
So i have a bare react-native application wherein i am using expo modules.
I am using the expo location module and getting the following error.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/home/amol/Desktop/AccountantComplete/CompleteCode/Accountant/node_modules/expo-location/android/src/main/java/expo/modules/location/LocationModule.java:361: error: cannot find symbol
new Permissions.PermissionsRequestListener() {
^
symbol: class PermissionsRequestListener
location: interface Permissions
/home/amol/Desktop/AccountantComplete/CompleteCode/Accountant/node_modules/expo-location/android/src/main/java/expo/modules/location/LocationModule.java:502: error: cannot find symbol
mPermissions.getPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
^
symbol: method getPermission(String)
location: variable mPermissions of type Permissions
/home/amol/Desktop/AccountantComplete/CompleteCode/Accountant/node_modules/expo-location/android/src/main/java/expo/modules/location/LocationModule.java:503: error: cannot find symbol
&& mPermissions.getPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED
^
symbol: method getPermission(String)
location: variable mPermissions of type Permissions
Note: /home/amol/Desktop/AccountantComplete/CompleteCode/Accountant/node_modules/expo-location/android/src/main/java/expo/modules/location/taskConsumers/GeofencingTaskConsumer.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':expo-location:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 16s
at checkExecSyncError (child_process.js:607:13)
at execFileSync (child_process.js:627:13)
at runOnAllDevices (/home/amol/Desktop/AccountantComplete/CompleteCode/Accountant/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at buildAndRun (/home/amol/Desktop/AccountantComplete/CompleteCode/Accountant/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at then.result (/home/amol/Desktop/AccountantComplete/CompleteCode/Accountant/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7);
So my best guess is there is an error while importing stuff from permission module.
So i have these lines in expo-permissions app level build.gradle file.
compileOnly('com.facebook.react:react-native:+') {
exclude group: 'com.android.support'
}
I am also using jettifier, i am guessing there is some issue with respect to transpiling code to android x.
I changed this
compileOnly('com.facebook.react:react-native:+') {
exclude group: 'com.android.support'
}
to
implementation 'com.facebook.react:react-native:+'
and everything works fine.
I would like to know exactly what is happening and if this deserves a pull request.
Any help on the same would be highly appreciated thanks.
ok, in my case I needed to raise the following versions from android/build.grade:
buildscript {
ext {
buildToolsVersion = "28.0.3" -> "29.0.2"
minSdkVersion = 21
compileSdkVersion = 28 -> 29
targetSdkVersion = 28 -> 29
}