You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-google-mobile-ads:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
// Top-level build file where you can add configuration options common to all sub-projects/modules.// https://github.com/DylanVann/react-native-fast-image/blob/main/docs/app-glide-module.md
project.ext {
excludeAppGlideModule =true
}
buildscript {
ext {
compileSdkVersion = findProperty("android.compileSdkVersion") asInteger
targetSdkVersion = findProperty("android.targetSdkVersion") asInteger
minSdkVersion = findProperty("android.minSdkVersion") asInteger
buildToolsVersion = findProperty("android.buildToolsVersion") asString
supportLibVersion = findProperty("android.supportLibVersion") asString
ndkVersion = findProperty("android.ndkVersion") asString
kotlinVersion ='1.6.20'
googlePlayServicesVersion ="17.0.0"
googlePlayServicesLocationVersion ="21.0.1"// Or higher.
}
repositories {
jcenter()
google()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath('de.undercouch:gradle-download-task:5.0.1')
classpath 'com.google.gms:google-services:4.3.14'
classpath "com.bugsnag:bugsnag-android-gradle-plugin:7.+"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"// NOTE: Do not place your application dependencies here; they belong// in the individual module build.gradle files
}
// Fixes this issue -> In order to compile Java 9+ source, please set compileSdkVersion to 30 or above// Sets compileSdkVersion for each subproject to the main version
subprojects { subproject->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
// Custom
}
}
android/app/build.gradle
apply plugin: "com.android.application"
apply plugin: "com.facebook.react"importcom.android.build.OutputFile/** * This is the configuration block to customize your React Native Android app. * By default you don't need to apply any configuration, just uncomment the lines you need.*/
react {
// bundleInInternalTest = true// bundleInStaging = true/* Folders */// The root of your project, i.e. where "package.json" lives. Default is '..'// root = file("../")// The folder where the react-native NPM package is. Default is ../node_modules/react-native// reactNativeDir = file("../node-modules/react-native")// The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen// codegenDir = file("../node-modules/react-native-codegen")// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js// cliFile = file("../node_modules/react-native/cli.js")/* Variants */// The list of variants to that are debuggable. For those we're going to// skip the bundling of the JS bundle and the assets. By default is just 'debug'.// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.// debuggableVariants = ["liteDebug", "prodDebug"]/* Bundling */// A list containing the node command and its flags. Default is just 'node'.// nodeExecutableAndArgs = ["node"]//// The command to run when bundling. By default is 'bundle'// bundleCommand = "ram-bundle"//// The path to the CLI configuration file. Default is empty.// bundleConfig = file(../rn-cli.config.js)//// The name of the generated asset file containing your JS bundle// bundleAssetName = "MyApplication.android.bundle"//// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
entryFile = file("../../index.ts")
//// A list of extra flags to pass to the 'bundle' commands.// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle// extraPackagerArgs = []/* Hermes Commands */// The hermes compiler command to run. By default it is 'hermesc'// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"//// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"// hermesFlags = ["-O", "-output-source-map"]
}
/** * Set this to true to create four separate APKs instead of one, * one for each native architecture. This is useful if you don't * use App Bundles (https://developer.android.com/guide/app-bundle/) * and want to have separate APKs to upload to the Play Store.*/def enableSeparateBuildPerCPUArchitecture =true
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"/** * Set this to true to Run Proguard on Release builds to minify the Java bytecode.*/def enableProguardInReleaseBuilds =false/** * The preferred build flavor of JavaScriptCore (JSC) * * For example, to use the international variant, you can use: * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default.*/def jscFlavor ='org.webkit:android-jsc:+'/** * Private function to get the list of Native Architectures you want to build. * This reads the value from reactNativeArchitectures in your gradle.properties * file and works together with the --active-arch-only flag of react-native run-android.*/defreactNativeArchitectures() {
def value = project.getProperties().get("reactNativeArchitectures")
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}
android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.findProperty("android.compileSdkVersion") asInteger
buildToolsVersion rootProject.findProperty("android.buildToolsVersion") asString
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
/* Required to enable us to build the bundled Facetec lib from react-native-facetec. Solution found here: https://stackoverflow.com/a/58602329*/
packagingOptions {
pickFirst '**/*.so'
exclude 'META-INF/androidx.*'
exclude 'androidx.*'
exclude 'META-INF/DEPENDENCIES'
}
defaultConfig {
manifestPlaceholders = [
// ...
]
minSdkVersion rootProject.findProperty("android.minSdkVersion") asInteger
targetSdkVersion rootProject.findProperty("android.targetSdkVersion") asInteger
applicationId findProperty("android.applicationId") asString
versionCode findProperty("android.versionCode") asInteger
versionName findProperty("android.versionName") asString
missingDimensionStrategy 'react-native-camera', 'general'
multiDexEnabled true
}
signingConfigs {
release {
...
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false// If true, also generate a universal APK
include (*reactNativeArchitectures())
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
bundle {
density.enableSplit =true
abi.enableSplit =true
language.enableSplit =false
}
packagingOptions {
pickFirst "lib/armeabi-v7a/libc++_shared.so"
pickFirst "lib/arm64-v8a/libc++_shared.so"
pickFirst "lib/x86/libc++_shared.so"
pickFirst "lib/x86_64/libc++_shared.so"
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant->
variant.outputs.each { output->// For each separate APK per architecture, set a unique version code as described here:// https://developer.android.com/studio/build/configure-apk-splits.htmldef versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi !=null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride = versionCodes.get(abi) *1+ defaultConfig.versionCode
}
}
}
}
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
// Custom
implementation 'com.android.support:multidex:1.0.3'
implementation "androidx.multidex:multidex:2.0.1"// Android 4.X needs this else there is an OKHTTP Class// https://github.com/square/okhttp/issues/4622#issuecomment-588261353
implementation("com.squareup.retrofit2:retrofit:2.7.1")
implementation("com.squareup.okhttp3:okhttp:3.12.8")
implementation "com.squareup.okhttp3:logging-interceptor:3.12.8"
implementation ('com.google.android.gms:play-services-vision:20.1.3')
implementation ('com.google.android.gms:play-services-vision-common:19.1.3')
implementation "com.google.android.gms:play-services-base:18.2.0"
implementation "com.google.android.gms:play-services-ads:21.0.0"
implementation 'com.google.android.gms:play-services-location:21.0.1'
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-v4:26.1.0'// old dependencies version;
resolutionStrategy.force 'androidx.appcompat:appcompat:1.3.1'
resolutionStrategy.force 'com.google.android.material:material:1.6.0'
resolutionStrategy {
eachDependency { DependencyResolveDetailsdetails->// ...
}
}
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply plugin: 'com.google.gms.google-services'
bugsnag {
uploadReactNativeMappings =true
}
android/settings.gradle
rootProject.name ='AppName'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
AndroidManifest.xml
The text was updated successfully, but these errors were encountered:
I think this is related to the incompatibility of the Reactnative and react-native-google-mobile-ads versions although it works on iOS.
PS: I updated the Kotlin version but got an error related to incompatible method signatures in the React Native UI Manager classes that the ads library is trying to use.
I see there's an existing discussion around detailing supported versions #688
What happened?
Android build failed with the error blow:
Platforms
Only on Android
React Native Info
Are your using Typescript?
package.json
app.json
ios/Podfile
android/build.gradle
android/app/build.gradle
android/settings.gradle
AndroidManifest.xml
The text was updated successfully, but these errors were encountered: