Issue with android gradle plugin version 3.3 and OneSignal - android

When I updated, Gradle 4.6 -> 4.10.1 and the Android Gradle plugin 3.2.1 -> 3.3.1, I get the following errors:
ERROR: Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.google.firebase:firebase-messaging:[10.2.1, 12.1.0).
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.android.support:support-v4:[26.0.0, 27.2.0).
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.android.support:customtabs:[26.0.0, 27.2.0).
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-location:[10.2.1, 12.1.0).
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[10.2.1, 12.1.0).
Show Details
Affected Modules: app
While inspecting dependancies I found OneSignal implementation 'com.onesignal:OneSignal:3.10.6' was throwing above errors for ex.
> Could not resolve com.google.android.gms:play-services-location:[15.0.0, 16.0.0).
Required by:
project :app > com.onesignal:OneSignal:3.10.6
> Failed to list versions for com.google.android.gms:play-services-location.
> Unable to load Maven meta-data from https://s3-ap-southeast-1.amazonaws.com/jp-build-packages/ec-android-sdk/com/google/android/gms/play-services-location/maven-metadata.xml.
> Could not get resource 'https://s3-ap-southeast-1.amazonaws.com/jp-build-packages/ec-android-sdk/com/google/android/gms/play-services-location/maven-metadata.xml'.
Now coming to https://s3-ap-southeast-1.amazonaws.com/jp-build-packages/ec-android-sdk is used to fetch the dependencies required for JustPay integration.
Problem
Why wrong repository is used when resolving above dependancies for compiling the project? Am I doing something wrong or something has changed in gradle 3.3 which is causing this? Or its an issue of gradle 3.3.1?
Solution : Excluding this libs does solves the problem.
implementation ('com.onesignal:OneSignal:3.10.6') {
exclude group : 'com.google.android.gms'
exclude group : 'com.android.support'
exclude group : 'com.google.firebase'
}
I am not sure, It may have adverse affects though(If any please do let me know). But I want to get to the root of the problem I want to know why this is only happening for Android Gradle plugin 3.3.1 and the same works just fine with Android Gradle plugin 3.2.1 i.e. without excluding this dependancies.
Here is my app/build.gradle file
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath "io.fabric.tools:gradle:$rootProject.fabricGradle"
}
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
apply plugin: 'project-report'
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://maven.google.com'
}
maven {
url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
}
maven {
url 'https://s3-ap-southeast-1.amazonaws.com/jp-build-packages/ec-android-sdk'
}
maven {
url 'https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/'
}
}
android {
....
....
}
dependencies {
...
implementation 'com.onesignal:OneSignal:3.10.6'
...
}
build.gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1
classpath 'com.google.gms:google-services:4.2.0'
classpath "io.realm:realm-gradle-plugin:5.8.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
...
}
Update : I know it has something to do with Improved classpath synchronization which is introduced in 3.3, but still have no clue why is it trying to resolve those dependencies with wrong repository.
Update 2
I have tried following as well
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
dependencies {
implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]' //as well ) at the end
}

Can you please try this:
Go to File -> Settings -> Build, Execution, Deployment -> Gradle ->
And uncheck "Offline work" option.
Update:
Remove below line of code
classpath 'com.google.gms:google-services:4.2.0'
from top-level build.gradle file sync and check it once.

Related

Illegal class file: Class module-info is missing a super type. Class file version 53

When I add firebase perf dependency into my project i am getting this error Illegal class file: Class module-info is missing a super type. Class file version 53.
My Gradle and google services project-level dependencies are
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
and I followed the exact steps mentioned in their docs https://firebase.google.com/docs/perf-mon/get-started-android.
I have tried clean and rebuild and clearing the Android Studio cache.
And also tried similarly issue resolution from StackOverflow
Project level build gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
classpath 'com.google.firebase:perf-plugin:1.3.1' // Performance Monitoring plugin
}
}
allprojects {
repositories {
google()
jcenter()
}
}
App level build gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
jcenter()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.31.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
// Apply the Performance Monitoring plugin to enable instrumentation
apply plugin: 'com.google.firebase.firebase-perf'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
maven {
url 'https://maven.google.com'
}
}
dependencies {
// Not added all dependencies , Just the firebase one SINCE ITS PRETTY LONG
implementation 'com.google.firebase:firebase-perf:19.0.0'
}
Adding this to your app-level build.gradle file solves the problem temporarily
debug {
FirebasePerformance {
// Set this flag to 'false' to disable #AddTrace annotation processing and
// automatic HTTP/S network request monitoring
// for a specific build variant at compile time.
instrumentationEnabled false
}
}
EDIT as per other answers and comments
Change the gradle plugin to 3.6.0 to resolve it as it has been fixed in that version
FYI, this was an AGP bug...it's been fixed in AGP 3.6
On updating build Gradle from 3.5.1 to 3.6.0 fixed my issue.
Also remove this from gradle.properties if you happen to have it there for any reason:
android.enableR8=false
(I got the error even with com.android.tools.build:gradle:4.1.2 if the above line was present)

Gradle sync error for go ethereum

In the app's build.gradle file, I have included the maven central repository and added the dependency
apply plugin: 'com.android.application'
repositories
{
mavenCentral()
}
dependencies {
compile 'org.ethereum:geth:1.8.7'
}
But the Gradle sync failed with this error
Failed to resolve: org.ethereum:geth:1.8.7
How do I fix this?
Write below code :
maven {
url "https://maven.google.com"
}
google()
instead
mavenCentral()

com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'

Error:Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'.
Possible causes for this unexpected error include:Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
In Android studio 3.0 on this problem, use the JakeWharton great god butterknife. Please how to deal with this problem, this is no problem on the Android studio 2.3. May be I used the wrong way, please advise, is originally used 8.5.1 version, an error, I upgraded to 8.6.0, found that the problem cannot be solved.
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "https://jitpack.io"
}
maven {
url 'https://maven.google.com'
}
maven {
url 'https://dl.google.com/dl/android/maven2/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.1+'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.6.0'
classpath ("com.tencent.mm:AndResGuard-gradle-plugin:1.2.3") { changing=true }
classpath 'com.letv.sarrsdesktop:BlockCanaryExPlugin:0.9.8.3'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url "https://jitpack.io"
}
maven {
url 'http://www.idescout.com/maven/repo/'
}
maven {
url "http://repo.baichuan-android.taobao.com/content/groups/BaichuanRepositories"
}
maven {
url 'https://maven.google.com'
}
maven {
url 'https://dl.google.com/dl/android/maven2/'
}
}
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
task printProps << {
println commandLineProjectProp
println gradlePropertiesProp
println systemProjectProp
println envProjectProp
println System.properties['system']
}
apply plugin: 'com.android.application'
//butterknife
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.jakewharton.butterknife'
/**
* library
*/
dependencies {
compile 'com.jakewharton:butterknife:8.6.0+'
apt 'com.jakewharton:butterknife-compiler:8.6.0+'
}
Downgrade butterknife-gradle-plugin to 8.4 or use 9.0 snapshot.
Kotlin 1.2.10
Gradle 3.0.1
Build tools version 27.0.3
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'com.jakewharton.butterknife'
In my library project this comment helped me (R2 imports):
https://github.com/JakeWharton/butterknife/issues/963#issuecomment-342547601
project's build.gradle:
buildscript {
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
google()
jcenter()
}
dependencies {
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
}
}
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
module's build.gradle:
apply plugin: 'com.jakewharton.butterknife'
...
dependencies {
compile 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
kapt 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
}
This way you can use the
apply plugin: 'com.jakewharton.butterknife'
Just remove
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
downgrade butterknifeversion to 8.4.0
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
Don't forget to remove below line
apply plugin: 'me.tatarka.retrolambda'

Failed to resolve: com.crashlytics.sdk.android:crashlytics:2.6.7

I added the following the in my project's build.gradle file:
Buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.14.3'
}
I addded this in the AndroidManifest.xml file:
<meta-data
android:name="io.fabric.ApiKey"
android:value="apiKeyValue"/>
I added this in the build.gradle(app) file:
apply plugin: 'io.fabric'
And the following dependency:
compile('com.crashlytics.sdk.android:crashlytics:2.6.7#aar') {
transitive = true;
}
After all this, why does not resolve the Crashlytics dependency?
Upgrade your dependencies like so:
Buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
//classpath 'io.fabric.tools:gradle:1.14.3' upgrade to the lastest version for compatibility
classpath 'io.fabric.tools:gradle:1.22.1'
}
And add the following in the build.gradle (app) file:
repositories {
maven { url 'https://maven.fabric.io/public' }
}
It is recommended to use 1.+ for the Fabric plugin dependency to use the latest version rather than specifying a specific version:
classpath 'io.fabric.tools:gradle:1.+'
There are detailed instructions on how to integrate Crashlytics into Android studio here.
Crashlytics Fabric.io deprecated.
use Firebase Crashlytics.

Failed to resolve: com.twitter.sdk.android:tweet-composer

compile('com.twitter.sdk.android:tweet-composer:0.8.0#aar')
{
transitive = true;
}
i got gradle from https://dev.twitter.com/twitter-kit/android/compose
But when Sync the Android Studio project following error is coming ..
Error:(53, 13) **Failed to resolve: **com.twitter.sdk.android:tweet-composer:0.8.0****
Show in FileShow in Project Structure dialog
As was described on twitter, you have to change some parts in your module build.gradle.
In your module you can use:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// The Fabric Gradle plugin uses an open ended version to
// react quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
//Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
I suggest you installing the Android Studio plugin.
It helps you to configure the gradle script.
This help me
https://dev.twitter.com/twitterkit/android/installation
dependencies {
// Include all the Twitter APIs
compile 'com.twitter.sdk.android:twitter:3.0.0'
// (Optional) Monetize using mopub
compile 'com.twitter.sdk.android:twitter-mopub:3.0.0'
}
OR
enter code dependencies {
compile 'com.twitter.sdk.android:twitter-core:3.0.0'
compile 'com.twitter.sdk.android:tweet-ui:3.0.0'
compile 'com.twitter.sdk.android:tweet-composer:3.0.0'
compile 'com.twitter.sdk.android:twitter-mopub:3.0.0'
}

Categories

Resources