React Native Admob Plugin - Build fails with latest React Native - react-native

D:\projects\fortuna\node_modules\react-native-admob\android\src\main\java\com\sbugert\rnadmob\RNAdMobRewardedVideoAdModule.java:89: error: method does not override or implement a method from a supertype
#Override
^
1 error
:react-native-admob:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-admob:compileReleaseJavaWithJavac'.
How can i fix this?

This answer is correct with old react versions. With latest version you should put this code in admob android build.gradle file: \node_modules\react-native-admob\android\build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.facebook.react:react-native:+'
implementation 'com.google.android.gms:play-services-ads:16.0.0'
}

There should be a
#Override
in line 89 of
RNAdMobRewardedVideoAdModule.java file.
Delete it and you should be good to go.

Related

Error while evaluating property 'filteredArgumentsMap' of task ':app:kaptGenerateStubsDebugKotlin'

Full info of Errors:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
What went wrong:
Execution failed for task ':app:kaptGenerateStubsDebugKotlin'.
Error while evaluating property 'filteredArgumentsMap' of task ':app:kaptGenerateStubsDebugKotlin'
Could not resolve all files for configuration ':app:kapt'.
> Could not resolve com.github.bumptech.glide:glide:compiler.
Required by:
project :app
> No cached version of com.github.bumptech.glide:glide:compiler available for offline mode.
> No cached version of com.github.bumptech.glide:glide:compiler available for offline mode.
2: Task failed with an exception.
What went wrong:
Execution failed for task ':app:javaPreCompileDebug'.
Could not resolve all files for configuration ':app:_agp_internal_javaPreCompileDebug_kaptClasspath'.
Could not resolve com.github.bumptech.glide:glide:compiler.
Required by:
project :app
> No cached version of com.github.bumptech.glide:glide:compiler available for offline mode.
> No cached version of com.github.bumptech.glide:glide:compiler available for offline mode.
I updated all highlighted values in both Gradle files, but my project still don't start. I was creating this project follow this tutorial (https://www.youtube.com/watch?v=nKz_GyCvitw&list=PLaQox2QQZDpjCmqVPvJ5eDyN26UYEojAt&index=9).
I think it`s problem with Dagger&Hilt, because main errors by functions kapt in Gradle file.
I tried start project in toggle offline mode
My Gradle (Module) file
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'androidx.navigation.safeargs.kotlin'
id 'dagger.hilt.android.plugin'
id 'kotlin-kapt'
}
android {
namespace 'com.example.movieapp'
compileSdk 33
defaultConfig {
applicationId "com.example.movieapp"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
dataBinding = true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
implementation 'com.google.dagger:hilt-android:2.31.2-alpha'
kapt 'com.google.dagger:hilt-android-compiler:2.31.2-alpha'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'androidx.paging:paging-runtime-ktx:3.1.1'
implementation 'com.github.bumptech.glide:glide:4.13.0'
kapt 'com.github.bumptech.glide:glide:compiler:4.13.0'
}
My Gradle (Project) file
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
id 'androidx.navigation.safeargs' version '2.4.2' apply false
id 'com.google.dagger.hilt.android' version '2.41' apply false
}

Gradle Sync Failed: Basic Functionality will not work

I checked all solutions and I got the answer that I need to update the Android -Studio version.
Android Studio: 3.2
Gradle Version: 5.1.1
Android Plugin Version: 3.4.2
This problem raised when I was trying to integrate Youtube API.
Gradle (project):
classpath 'com.android.tools.build:gradle:3.4.2'
Tried to update AS version, but still, it is showing AS 3.2
android {
compileSdkVersion 28
defaultConfig {
applicationId "mateiladesign.practice.com.materialdesign"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0 alpha-03' //2.2.0-alpha03 2.0.0-alpha01
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.3.0-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02'
//AndroidX
implementation 'com.google.android.material:material:1.1.0 alpha09' //1.0.0-alpha03
//Recycler
implementation 'com.android.support:recyclerview-v7:28.0.0'
//Hodenhof Circle ImageView
implementation 'de.hdodenhof:circleimageview:3.0.0'
//Glide
implementation 'com.github.bumptech.glide:glide:4.9.0'
//YTAPI
implementation files('libs/YouTubeAndroidPlayerApi.jar')
}
What do I do to resolve this issue?
Cause: org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()Lorg/gradle/api/artifacts/ModuleIdentifier;

Why am I getting this error in react native?

I am new to react native. When I run react-native run-android I get this error.
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\Stay Hungry\app developement\Aarogya\node_modules\react-native-share\android\build.gradle' line: 53
* What went wrong:
A problem occurred evaluating project ':react-native-share'.
> Could not find method compileOnly() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* 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: 7 mins 24.686 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
I traced the path to the error location and my build.gradle is below:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
apply plugin: 'com.android.library'
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
android {
compileSdkVersion safeExtGet('compileSdkVersion', 27)
buildToolsVersion safeExtGet('buildToolsVersion', '27.0.3')
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 27)
versionCode 1
versionName "1.0.0"
}
lintOptions {
abortOnError false
warning 'InvalidPackage'
}
}
repositories {
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
jcenter()
}
dependencies {
compileOnly "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
implementation "com.android.support:appcompat-v7:${safeExtGet('supportLibVersion', '27.1.0')}"
}
I have no idea what is wrong here. I have not even started writing code in app.js yet. I am using a physical device to run the code with an adb device.
The error you are getting is from the library react-native-share.
Did you follow the instructions to installing it right?

react-native-mauron85-background geolocation error

The following error appears when try to build my react native for production (running ./gradlew assembleRelease),
...
/node_modules/react-native-mauron85-background-geolocation/android/common/src/oreo/java/com/marianhello/bgloc/NotificationHelper.java:4: error: cannot find symbol
import android.app.NotificationChannel;
^
symbol: class NotificationChannel
location: package android.app
...
Execution failed for task ':react-native-mauron85-background-geolocation-common:compileOreoReleaseJavaWithJavac'
Anybody encountered this error before?
Just adding what solved my problem in case anyone is having the same problem.
After tearing off a lot of hairs (although I lack it) I came to a solution. Not sure whether is gonna work for others, you can give it a try.
Add following codes in android/build.gradle
allprojects {
repositories {
mavenLocal()
jcenter()
maven { url "https://maven.google.com" }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
ext {
compileSdkVersion = 26
targetSdkVersion = 26
buildToolsVersion = "26.0.2"
supportLibVersion = "26.1.0"
googlePlayServicesVersion = "11.8.0"
}
And make sure the dependencies are installed.

Android studio Gradle BUILD SUCCESSFUL despite cannot resolve android.support.v4

Despite Gradle is telling me build succesfull (and I can run the app), android studio cannot resolve "import android.support.v4" and for the support.v7 lib can only resolve appcompat... I tried the button "Use Sync project with gradle files", upgraded my build tools to the latest version but I still have this error.
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "me.myapp"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'org.jsoup:jsoup:1.8.2'
compile 'com.android.support:recyclerview-v7:22.1.1'
compile 'com.android.support:support-v4:22.1.1'
compile 'com.android.support:appcompat-v7:22.1.1'
}
Please help me fix this!
Follow the below steps.
Run all updates: Update android studio and SDK to the latest version.
go to File->invalidate caches/Restart.
Hope this fixes the problem.