OneSignal / OneSignal-Android-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native Android or Amazon app with OneSignal. https://onesignal.com
Other
604 stars 368 forks source link

Could not GET 'https://s3.amazonaws.com/moat-sdk-builds/androidx/annotation/annotation/28.0.0/annotation-28.0.0.pom'. Received status code 403 from server: Forbidden Enable Gradle 'offline mode' and sync project #809

Closed trungphan9x closed 5 years ago

trungphan9x commented 5 years ago

Description: After updating the gradle file (app and project level) based on this instruction https://documentation.onesignal.com/docs/android-sdk-setup, I sync project with Gradle files , but got this issues:

Could not GET 'https://s3.amazonaws.com/moat-sdk-builds/androidx/annotation/annotation/28.0.0/annotation-28.0.0.pom'. Received status code 403 from server: Forbidden Enable Gradle 'offline mode' and sync project

After I click this:

Enable Gradle 'offline mode' and sync project

, it showed another message like this

No cached version of androidx.annotation:annotation:28.0.0 available for offline mode. Disable Gradle 'offline mode' and sync project

Environment

buildscript { repositories { maven { url 'https://plugins.gradle.org/m2/'} } dependencies { classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.2' } }

android { compileSdkVersion gradle.compileSdk defaultConfig { applicationId "live.vingo.androidkr" manifestPlaceholders = [ onesignal_app_id: '41adfc41-323d-4216-b92b-ca6e480aaee9', // Project number pulled from dashboard, local value is ignored. onesignal_google_project_number: 'REMOTE' ]

    minSdkVersion gradle.minSdk
    targetSdkVersion gradle.targetSdk
    versionCode gradle.versionCode
    versionName gradle.versionName
    vectorDrawables.useSupportLibrary true
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}
buildTypes {
    release {
        //buildConfigField "String", "API_URL", "\"https://vingoapi.spryfitdev.com/\""      //USA server
        //buildConfigField "String", "API_URL", "\"https://ca.fingo.today/\""              //DEV client
        buildConfigField "String", "API_URL", "\"https://krapi.vingo.live/\""          //Korea server
        //buildConfigField "String", "API_URL", "\"https://devca.spryfitdev.com/\""          //DEV server

        buildConfigField "String", "TRACKER_URL", "\"https://tracker.spryfitdev.com/\""    //Tracker Server

        //minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguards/proguard-rules.pro'

    }
    debug {
        //buildConfigField "String", "API_URL", "\"https://vingoapi.spryfitdev.com/\""        //USA server
        //buildConfigField "String", "API_URL", "\"https://ca.fingo.today/\""             //DEV client
        buildConfigField "String", "API_URL", "\"https://krapi.vingo.live/\""             //Korea server
        //minifyEnabled false
        //buildConfigField "String", "API_URL", "\"https://devca.spryfitdev.com/\""          //DEV server

        buildConfigField "String", "TRACKER_URL", "\"https://tracker.spryfitdev.com/\""    //Tracker Server

    }
}

flavorDimensions "version"
productFlavors {
    dev {
        dimension "version"
        //applicationIdSuffix ".dev"
    }
    prod {
        dimension "version"
    }
}

dataBinding {
    enabled = true
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

lintOptions {
    abortOnError false
}

}

repositories { maven { url 'https://jitpack.io' } maven { url "https://adcolony.bintray.com/AdColony" } maven { url "https://dl.bintray.com/vdopiacorp/sdk" } maven { url "https://s3.amazonaws.com/moat-sdk-builds" } maven { url 'https://tapjoy.bintray.com/maven' }

// If you're using a version of Gradle greater than or equal to 4.1, you must use:
google()

// If you're using a version of Gradle lower than 4.1, you must use:
//maven { url 'https://maven.google.com' }

maven { url "https://maven.fabric.io/public" }
maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }

}

dependencies {

//implementation "app.spryfit:tracker:0.0.4"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$rootProject.kotlinVersion"
implementation "androidx.appcompat:appcompat:$rootProject.appcompatVersion"
implementation "androidx.recyclerview:recyclerview:$rootProject.recyclerViewVersion"

implementation "androidx.constraintlayout:constraintlayout:$rootProject.constraintLayoutVersion"
implementation "android.arch.navigation:navigation-fragment:$rootProject.navigationVersion"
implementation "android.arch.navigation:navigation-ui:$rootProject.navigationVersion"
implementation "android.arch.navigation:navigation-fragment-ktx:$rootProject.navigationVersion"
implementation "android.arch.navigation:navigation-ui-ktx:$rootProject.navigationVersion"
implementation "androidx.core:core-ktx:$rootProject.ktxVersion"
implementation "android.arch.paging:runtime:$rootProject.pagingVersion"
implementation 'androidx.multidex:multidex:2.0.0'

// Retrofit
implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion"

//okHttp
implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.okhttpVersion"
implementation "com.squareup.okhttp3:okhttp:$rootProject.okhttpVersion"

// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.lifecycleVersion"

// DI Koin
implementation "org.koin:koin-core:$rootProject.koinVersion"
implementation "org.koin:koin-android:$rootProject.koinVersion"
implementation "org.koin:koin-androidx-viewmodel:$rootProject.koinVersion"
implementation "org.koin:koin-androidx-scope:$rootProject.koinVersion"
//rx
implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxAndroidVersion"
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxJavaVersion"

//google
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.firebase:firebase-config:18.0.0'
implementation 'com.google.firebase:firebase-database:18.0.0'

implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'

implementation 'com.google.android.gms:play-services-location:17.0.0'

implementation 'com.google.android.gms:play-services-base:17.0.0'
implementation 'com.google.android.gms:play-services-ads:18.1.0'

implementation 'com.google.android.gms:play-services-plus:17.0.0'
// Facebook
implementation 'com.facebook.android:facebook-login:5.1.0'
implementation 'com.facebook.android:facebook-share:5.1.0'
implementation 'com.facebook.android:facebook-android-sdk:5.1.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'

implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.0.0'
kapt 'com.github.bumptech.glide:compiler:4.8.0'

implementation 'com.importre:kotlin-unwrap:0.3.2'
implementation 'gun0912.ted:tedpermission-rx2:2.2.0'

implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'

implementation 'com.applovin:applovin-sdk:+'

implementation 'me.relex:circleindicator:1.2.2@aar'

// branch
implementation 'io.branch.sdk.android:library:[2.19.5, 2.99.99]'

implementation('io.socket:socket.io-client:1.0.0') {
    // excluding org.json which is provided by Android
    exclude group: 'org.json', module: 'json'
}

implementation 'com.airbnb.android:lottie:2.7.0'

implementation 'com.devbrackets.android:exomedia:4.3.0'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
    exclude group: 'com.android.support', module: 'support-annotations'
    exclude group: 'androidx.annotation', module:'support-annotations'
})

implementation group: 'com.zendesk', name: 'support', version: '2.2.1'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta1'
implementation project(path: ':sstracker')

implementation fileTree(include: ['*.jar'], dir: 'libs')

implementation 'com.inmobi.monetization:inmobi-ads:7.2.8'

implementation 'com.squareup.picasso:picasso:2.5.2'

//Note: if you are using Pre-roll, un-comment the following line:
//implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.7.4'

//You do not have to use support library version 27.1.1, however, whichever version you do use
//must be the same throughout this gradle file.  This does not apply to multidex.
//Do not use '+' wildcards in the android support library version.
implementation "com.android.support:support-annotations:28.0.0"
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:support-v4:28.0.0"
implementation project(path: ':fitbitcommon')
implementation project(path: ':fitbitauth')
implementation project(path: ':fitbitapi')

implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'android.arch.work:work-runtime:1.0.1'

implementation 'com.evernote:android-job:1.2.6'

//Kakao
//compile project(':loginbase-template')
implementation 'com.kakao.sdk:usermgmt:1.19.0'
implementation 'com.kakao.sdk:kakaolink:1.19.0'
implementation 'com.kakao.sdk:kakaotalk:1.19.0'
implementation 'com.kakao.sdk:kakaonavi:1.19.0'
implementation 'com.kakao.sdk:kakaostory:1.19.0'

//OneSignal
implementation ('com.onesignal:OneSignal:3.11.1') {
    exclude group: 'com.google.firebase', module:'firebase-messaging'
    exclude group: 'androidx.annotation', module:'support-annotations'

}

}

configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == 'com.android.support') { if (!requested.name.startsWith("multidex")) { details.useVersion("$rootProject.ext.supportLibraryVersion") } } } }

apply plugin: 'com.google.gms.google-services'

apply plugin: 'kotlin-android-extensions'


- This is my gradle file (project level):
// Top-level build file where you can add configuration options common to all sub-projects/modules.

```gradle
buildscript {
    ext {
        appcompatVersion = '1.0.2'
        recyclerViewVersion = '1.0.0'
        constraintLayoutVersion = '1.1.3'
        gradleVersion = '3.4.2'
        gsonVersion = '2.8.2'
        kotlinVersion = '1.3.21'
        ktxVersion = '1.0.1'
        lifecycleVersion = '2.0.0'
        navigationVersion = '1.0.0-alpha07'
        roomVersion = '2.1.0-alpha01'
        rxJavaVersion = '2.2.0'
        rxAndroidVersion = '2.1.0'
        retrofitVersion = '2.4.0'
        okhttpVersion = '3.10.0'
        koinVersion = '1.0.1'
        pagingVersion = '1.0.1'
        supportLibraryVersion = '28.0.0'
    }
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
        mavenCentral()

    }
    dependencies {
        classpath "com.android.tools.build:gradle:$gradleVersion"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21"

        classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.fabric.tools:gradle:1.28.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://zendesk.jfrog.io/zendesk/repo' }

        subprojects {
            project.configurations.all {
                resolutionStrategy.eachDependency { details ->
                    if (details.requested.group == 'com.google.android.gms'
                            && !details.requested.name.contains('multidex') ) {
                        details.useVersion "17.0.0"
                    }
                }
            }
        }

    }
    tasks.withType(JavaCompile) {
        options.compilerArgs << "-Xlint:deprecation"
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Could someone please figure out why and how I can solve this problem?

rgomezp commented 5 years ago

Howdy! It's not clear exactly what the issue is since it seems like a problem with another plugin. However, I would just say to make sure you have migrated to AndroidX correctly

trungphan9x commented 5 years ago

Howdy! It's not clear exactly what the issue is since it seems like a problem with another plugin. However, I would just say to make sure you have migrated to AndroidX correctly

I migrated to Androidx for long time ago. Now I just try to integrate Onesignal to the current project, but it was failed like that, I have no idea to solve this problem actually.

jkasten2 commented 5 years ago

@trungphan9x There are a number of things that may be causing the issue. There is an out of order google() reference causing the wrong repos to be checked first, apply on onesignal-gradle-plugin needs to be after defining it's version, and there is forced versioning happening with resolutionStrategy.eachDependency that could be causing the 28.0.0 trying to be resolved for androidX which does not exist.

Can you try replacing your build.gradle files with the ones noted here? https://gist.github.com/jkasten2/5a8826f50e71e175e7ed7347befdbb58 Or see the specific changes here: https://gist.github.com/jkasten2/5a8826f50e71e175e7ed7347befdbb58/revisions#diff-74eebd6227d31ffeaa1c683cc967ceb7

trungphan9x commented 5 years ago

@trungphan9x There are a number of things that may be causing the issue. There is an out of order google() reference causing the wrong repos to be checked first, apply on onesignal-gradle-plugin needs to be after defining it's version, and there is forced versioning happening with resolutionStrategy.eachDependency that could be causing the 28.0.0 trying to be resolved for androidX which does not exist.

Can you try replacing your build.gradle files with the ones noted here? https://gist.github.com/jkasten2/5a8826f50e71e175e7ed7347befdbb58 Or see the specific changes here: https://gist.github.com/jkasten2/5a8826f50e71e175e7ed7347befdbb58/revisions#diff-74eebd6227d31ffeaa1c683cc967ceb7

Hi @jkasten2 , Thank for your suggestion, I changed to all the tips you suggested to me but it has still not worked for me. I still got the same issue after doing that.

rgomezp commented 5 years ago

Could you please post your updated gradle file?

jkasten2 commented 5 years ago

@trungphan9x I believe the issue was related to a bug with the OneSignal-Gradle-Plugin which was just fixed yesterday. https://github.com/OneSignal/OneSignal-Gradle-Plugin/releases/tag/0.12.3

If you update to classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.3' it should fix any AndroidX errors trying to get 26.0.0 or 28.0.0

trungphan9x commented 5 years ago

@trungphan9x I believe the issue was related to a bug with the OneSignal-Gradle-Plugin which was just fixed yesterday. https://github.com/OneSignal/OneSignal-Gradle-Plugin/releases/tag/0.12.3

If you update to classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.3' it should fix any AndroidX errors trying to get 26.0.0 or 28.0.0

@jkasten2 It worked like a charm now. Thank you so much~~

jkasten2 commented 5 years ago

@trungphan9x Good to hear, glad I could help!