Google Play Services Ads? - android-gradle-plugin

I cant add android studio App Admob to an app.
grandle Could not download this
'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/3.1.1/google-services-3.1.1.pom'.
Could not GET 'https://jcenter.bintray.com/com/google/gms/google-services/3.1.1/google-services-3.1.1.pom'.
Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
SCREENSHOTS
SCREENSHOTS1
SCREENSHOTS2
SCREENSHOTS3
SCREENSHOTS4
SCREENSHOTS5

Related

React-native latest changes/code is not being reflected in the build after running assembleRelase command

I am facing the problem with my release apk which is not updated with my latest code(If i made any changes in code, that reflects locally but not reflecting in release apk). I am using ./gradlew assembleRelease.
I have tried several solutions as
Release APK Not Updating With JavaScript Code
I have shared my build.gradle file for reference.
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 19
compileSdkVersion = 29
targetSdkVersion = 29
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.1")
classpath 'com.google.gms:google-services:4.3.4'
}
}
allprojects {
repositories {
mavenLocal()
maven {
url("$rootDir/../node_modules/react-native/android")
}
maven {
url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
url 'https://maven.cashfree.com/release'
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}

fails to build an (newly created) ejected expo project

I am trying to add react-native-firebase to a newly created expo project, I ejected the app successfully, but when I try to add the library the project fails to build and I get the following error
ERROR: In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[15.0.
1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.android.gms:play-services-flags:15.0.1 -> com.google.android.gms:play-services-basement#[
15.0.1], but play-services-basement version was 16.2.0.
I updated all firbase dependencies but it still fails, I then used this line to force stop the errors so I can at least build
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
the previous error is gone but I keep different errors. eg:
Error: Program type already present: com.google.android.gms.internal.measurement.zzbk
platform: Ubuntu 19:04
expo: Latest
react-native-firebase: 5.2.5
gradle (project) file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/android/android-tools/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
// classpath 'com.google.gms:google-services:3.2.1'
classpath 'de.undercouch:gradle-download-task:2.0.0'
classpath 'com.amazonaws:aws-devicefarm-gradle-plugin:1.3' // https://github.com/awslabs/aws-device-farm-gradle-plugin/releases
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
// For non-detach
maven {
url "$rootDir/maven"
}
// For old expoviews to work
maven {
url "$rootDir/versioned-abis/expoview-abi26_0_0/maven"
}
maven {
url "$rootDir/versioned-abis/expoview-abi27_0_0/maven"
}
maven {
url "$rootDir/versioned-abis/expoview-abi28_0_0/maven"
}
maven {
url "$rootDir/versioned-abis/expoview-abi29_0_0/maven"
}
maven {
url "$rootDir/versioned-abis/expoview-abi30_0_0/maven"
}
maven {
url "$rootDir/versioned-abis/expoview-abi31_0_0/maven"
}
maven {
url "$rootDir/versioned-abis/expoview-abi32_0_0/maven"
}
// For detach
maven {
url "$rootDir/../node_modules/expokit/maven"
}
maven {
// We use a modified build of com.android.support.test:runner:1.0.1. Explanation in maven-test/README
url "$rootDir/maven-test"
}
maven {
// Local Maven repo containing AARs with JSC built for Android
url "$rootDir/../node_modules/jsc-android/dist"
}
flatDir {
dirs 'libs'
// dirs project(':expoview').file('libs')
}
// https://github.com/google/ExoPlayer/issues/5225#issuecomment-445739013
maven { url 'https://google.bintray.com/exoplayer' }
maven { url "https://jitpack.io" }
// Want this last so that we never end up with a stale cache
mavenLocal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle (app)
buildscript {
repositories {
google()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.26.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'devicefarm'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 27
defaultConfig {
applicationId 'expo.reactnative.test'
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName '1.0.0'
ndk {
abiFilters 'armeabi-v7a', 'x86'
}
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Deprecated. Used by net.openid:appauth
manifestPlaceholders = [
'appAuthRedirectScheme': 'host.exp.exponent'
]
}
dexOptions {
javaMaxHeapSize System.getenv("DISABLE_DEX_MAX_HEAP") ? null : "8g"
}
flavorDimensions 'remoteKernel'
productFlavors {
devKernel {
dimension 'remoteKernel'
}
prodKernel {
dimension 'remoteKernel'
}
}
signingConfigs {
debug {
storeFile file('../debug.keystore')
}
release {
storeFile file(System.getenv("ANDROID_KEYSTORE_PATH") ?: "release-key.jks")
storePassword System.getenv("ANDROID_KEYSTORE_PASSWORD")
keyAlias System.getenv("ANDROID_KEY_ALIAS")
keyPassword System.getenv("ANDROID_KEY_PASSWORD")
}
}
buildTypes {
debug {
debuggable true
ext.enableCrashlytics = false
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
lintOptions {
abortOnError false
}
packagingOptions {
pickFirst "**"
}
configurations.all {
resolutionStrategy.force 'com.android.support:design:27.1.0'
}
}
devicefarm {
projectName System.getenv("DEVICEFARM_PROJECT_NAME")
devicePool System.getenv("DEVICEFARM_DEVICE_POOL")
executionTimeoutMinutes 40
authentication {
accessKey System.getenv("AWS_ACCESS_KEY_ID")
secretKey System.getenv("AWS_SECRET_ACCESS_KEY")
}
}
configurations.all {
resolutionStrategy {
force 'org.webkit:android-jsc:r224109'
}
}
// WHEN_PREPARING_SHELL_REMOVE_FROM_HERE
apply from: 'expo.gradle'
// WHEN_PREPARING_SHELL_REMOVE_TO_HERE
dependencies {
implementation project(':react-native-firebase')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-analytics:16.5.0'
// Firebase dependencies
implementation "com.google.android.gms:play-services-base:16.1.0"
//
implementation 'com.android.support:multidex:1.0.1'
// Our dependencies
implementation 'com.android.support:appcompat-v7:27.1.1'
// Our dependencies from ExpoView
// DON'T ADD ANYTHING HERE THAT ISN'T IN EXPOVIEW. ONLY COPY THINGS FROM EXPOVIEW TO HERE.
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.facebook.android:facebook-android-sdk:4.37.0'
implementation('com.facebook.android:audience-network-sdk:4.99.0') {
exclude module: 'play-services-ads'
}
compileOnly 'org.glassfish:javax.annotation:3.1.1'
implementation 'com.jakewharton:butterknife:8.4.0'
implementation 'de.greenrobot:eventbus:2.4.0'
// Be careful when upgrading! Upgrading might break experience scoping. Check with Jesse. See Analytics.resetAmplitudeDatabaseHelper
implementation 'com.amplitude:android-sdk:2.9.2'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-gcm:16.1.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.8'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-ads:17.2.0'
annotationProcessor 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
implementation "com.raizlabs.android:DBFlow-Core:2.2.1"
implementation "com.raizlabs.android:DBFlow:2.2.1"
implementation "com.madgag.spongycastle:core:1.53.0.0"
implementation "com.madgag.spongycastle:prov:1.53.0.0"
debugImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
implementation 'com.facebook.device.yearclass:yearclass:2.1.0'
implementation 'commons-io:commons-io:1.4'
implementation 'me.leolin:ShortcutBadger:1.1.4#aar'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.yqritc:android-scalablevideoview:1.0.1'
implementation 'commons-codec:commons-codec:1.10'
implementation 'com.segment.analytics.android:analytics:4.3.0'
implementation 'com.google.zxing:core:3.3.3'
implementation 'net.openid:appauth:0.4.1'
implementation('com.airbnb.android:lottie:2.5.5') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
implementation('io.nlopez.smartlocation:library:3.2.11') {
transitive = false
}
implementation 'com.android.support:exifinterface:27.1.1'
implementation 'com.squareup.okio:okio:1.9.0'
implementation 'com.facebook.soloader:soloader:0.5.1'
implementation 'com.google.android.exoplayer:exoplayer:2.6.1'
implementation 'expolib_v1.com.google.android.exoplayer:expolib_v1-extension-okhttp:2.6.1#aar'
// expo-file-system
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
// Testing
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// We use a modified build of com.android.support.test:runner:1.0.1. Explanation in maven-test/README
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support:support-annotations:27.1.1'
androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.0'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'org.robolectric:robolectric:3.8'
testImplementation 'com.android.support.test:runner:1.0.2-alpha1'
testImplementation 'com.android.support.test:rules:1.0.2-alpha1'
implementation('host.exp.exponent:expoview:32.0.0#aar') {
transitive = true
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
exclude group: 'com.squareup.okhttp3', module: 'okhttp-urlconnection'
}
api 'com.facebook.react:react-native:32.0.0'
api 'host.exp.exponent:expo-app-loader-provider:1.0.0'
api 'host.exp.exponent:expo-core:2.0.0'
api 'host.exp.exponent:expo-constants-interface:2.0.0'
api 'host.exp.exponent:expo-constants:2.0.1'
api 'host.exp.exponent:expo-errors:1.0.0'
api 'host.exp.exponent:expo-file-system-interface:2.0.0'
api 'host.exp.exponent:expo-file-system:2.0.0'
api 'host.exp.exponent:expo-image-loader-interface:2.0.0'
api 'host.exp.exponent:expo-permissions:2.0.0'
api 'host.exp.exponent:expo-permissions-interface:2.0.0'
api 'host.exp.exponent:expo-sensors-interface:2.0.0'
api 'host.exp.exponent:expo-react-native-adapter:2.0.0'
api 'host.exp.exponent:expo-task-manager:1.0.0'
api 'host.exp.exponent:expo-task-manager-interface:1.0.0'
// Optional universal modules, could be removed
// along with references in MainActivity
api 'host.exp.exponent:expo-ads-admob:2.0.0'
api 'host.exp.exponent:expo-app-auth:2.0.0'
api 'host.exp.exponent:expo-analytics-segment:2.0.0'
api 'host.exp.exponent:expo-barcode-scanner-interface:2.0.0'
api 'host.exp.exponent:expo-barcode-scanner:2.0.0'
api 'host.exp.exponent:expo-camera-interface:2.0.0'
api 'host.exp.exponent:expo-camera:2.0.0'
api 'host.exp.exponent:expo-contacts:2.0.0'
api 'host.exp.exponent:expo-face-detector:2.0.0'
api 'host.exp.exponent:expo-face-detector-interface:2.0.0'
api 'host.exp.exponent:expo-font:2.0.0'
api 'host.exp.exponent:expo-gl-cpp:2.0.0'
api 'host.exp.exponent:expo-gl:2.0.0'
api 'host.exp.exponent:expo-google-sign-in:2.0.0'
api 'host.exp.exponent:expo-local-authentication:2.0.0'
api 'host.exp.exponent:expo-localization:2.0.0'
api 'host.exp.exponent:expo-location:2.0.1'
api 'host.exp.exponent:expo-media-library:2.0.0'
api 'host.exp.exponent:expo-print:2.0.0'
api 'host.exp.exponent:expo-sensors:2.0.0'
api 'host.exp.exponent:expo-sms:2.0.0'
api 'host.exp.exponent:expo-background-fetch:1.0.0'
}
// This has to be down here for some reason
apply plugin: 'com.google.gms.google-services'
}
// This has to be down here for some reason
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
Add
maven { // expo-camera bundles a custom
com.google.android:cameraview url
"$rootDir/../node_modules/expo-camera/android/maven" }
to build.gradle at
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
maven { // expo-camera bundles a custom com.google.android:cameraview url
"$rootDir/../node_modules/expo-camera/android/maven" }
google()
jcenter()
maven { url 'https://jitpack.io' }
} }
This works for me.
maven { // expo-camera bundles a custom
url("$rootDir/../node_modules/expo-camera/android/maven")
}

A problem occurred configuring project ':app'

Getting error when trying react-native run-android.I don't know why I'm getting this error.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-vector-icons'.
> Could not resolve all dependencies for configuration ':react-native-vector-icons:classpath'.
> Could not find any matches for com.android.tools.build:gradle:2.3.+ as no versions of com.android.tools.build:gradle are available.
android\build.gradle is as follows.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is
installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
gradle version: 3.3,
plugin:2.2.3
Upgrade react-native-vector-icons: "^6.0.2" in package.json
Then run npm i react-native-vector-icons
As a last step, cd android && ./gradlew clean.
Change dependencies from:
dependencies {
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
}
to:
dependencies {
compile "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
}
also change buildscript dependencies to use: classpath 'com.android.tools.build:gradle:2.2.3'
and maven { url "https://dl.bintray.com/android/android-tools/" } instead of google()
So your ../node_modules/react-native-vector-icons/android/build.gradle should look like this:
buildscript {
repositories {
maven { url "https://dl.bintray.com/android/android-tools/" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
apply plugin: 'com.android.library'
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
android {
compileSdkVersion safeExtGet('compileSdkVersion', 26)
buildToolsVersion safeExtGet('buildToolsVersion', '26.0.3')
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 26)
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
}
repositories {
mavenCentral()
}
dependencies {
compile "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
}

React-Native Android generate Signed apk: Build Gradle error

Build.gradle error on Line 2.
I followed the steps described in https://facebook.github.io/react-native/releases/0.31/docs/signed-apk-android.html
// Top-level build file where you can add configuration options common to all sub-projects/modules.
signingConfigs {
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
Can someone please point out where I went wrong?
You are working in android/build.gradle, but you are supposed to add those lines in android/src/build.gradle.

Crashlytics Error:(11, 0) Plugin with id 'io.fabric' not found compile lib

I am getting the error,
Error:(11, 0) Plugin with id 'io.fabric' not found
when trying to run crashlytics on my project.
I faced the same issue, when tried to use Fabric plugin for android studio(automated code generation by plugin).I followed this documentation also.
And finally, I could see there were some missed lines in build.gradle.
So this is the top level project build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'java'
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
}
and this is the build.gradle for app module
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "your application package name"
minSdkVersion 10
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:support-v4:22.0.0'
testCompile 'junit:junit:4.12'
testCompile "org.mockito:mockito-core:1.9.5"
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
}
and at last "clean build" and all was set for me.
I ended up creating an empty project and using the plugin on it and then I compared the gradle file and realized that this was not being added
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
in your project gradle file:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'java'
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
}
in your app gradle file:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "your application package name"
minSdkVersion 10
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:support-v4:22.0.0'
testCompile 'junit:junit:4.12'
testCompile "org.mockito:mockito-core:1.9.5"
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
}
You just forget to add below mentioned line in Project level gradle file.
maven { url 'https://maven.fabric.io/public' }
Also please add below mentioned line in dependencies (in project level gradle file)
classpath 'io.fabric.tools:gradle:1.26.1'
I think you lost "google()" in repositories of buildscript.
buildscript {
repositories {
jcenter()
google()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'io.fabric.tools:gradle:1.+'
}
}
allprojects {
repositories {
jcenter()
}
}
I have faced this issue while working with Android + Cordova + Angularjs Hybrid project.
apply plugin: 'io.fabric'
By commenting this line at the path /app/build.gradle solved the issue.
Hope it helps someone!!