gradle unresolved dependencies - android

I have a problem in the Gradle files. As I have updated the Android Studio I had to update the dependencies as well, but I'm getting unresolved dependencies.
Project gradle:
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'io.fabric.tools:gradle:1.29.0'
classpath 'com.novoda:bintray-release:0.4.1'
classpath 'com.google.gms:google-services:4.1.0'
}
}
allprojects {
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
}
app gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.packagename"
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
lintOptions {
disable "ResourceType"
}
}
ext {
googlePlayServicesVersion = "4.2.0"
}
dependencies {
implementation files('libs/icu4j-4_4_2_2.jar')
implementation files('libs/jsoup-1.6.3.jar')
implementation files('libs/ksoap2-android-assembly-2.6.0-jar-with-dependencies.jar')
implementation files('libs/zip4j_1.2.6.jar')
implementation('com.crashlytics.sdk.android:crashlytics:2.9.9#aar') {
transitive = true;
}
implementation 'com.facebook.android:facebook-android-sdk:4.38.1'
// Google
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation'com.google.firebase:firebase-auth:16.1.0'
// Firebase
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.android.gms:play-services-ads:17.2.1'
implementation project(':pdflibrary')
implementation 'com.android.support:support-compat:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:customtabs:27.0.2'
implementation files('libs/junit-4.3.jar')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.android.gms:play-services-flags:16.0.1'
implementation 'com.google.android.gms:play-services-basement:16.0.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
pdfLibrary gradle:
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName '1'
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
}
publish {
userOrg = 'thefinestartist'
groupId = 'com.thefinestartist'
artifactId = 'finestwebview'
publishVersion = '1'
desc = 'Beautiful and customizable Android Activity that shows web pages within an app.'
website = 'https://github.com/TheFinestArtist/FinestWebView-Android'
}
This is the errors I'm getting knowing that min-sdk is set to 24 and I only in the gradle and I have removed it from both manifests (app & pdfLibrary):
I have tried suggestion from other SO questions, but nothing worked.

edit minSdkVersion to 21 instead of 24 in pdfLibrary gradle
an sync project

In the allprojects block you have to add the google() maven repo.
allprojects {
repositories {
google()
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
}

Related

Could not resolve com.irozon.sneaker:sneaker:2.0.0

Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.irozon.sneaker:sneaker:2.0.0.
Show Details
Affected Modules: app
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.sliderscreen"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-
android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-
stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation
'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation
'com.google.android.material:material:1.2.1'
implementation
'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation 'androidx.drawerlayout:drawerlayout:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
implementation 'com.synnapps:carouselview:0.1.4'
implementation 'com.irozon.sneaker:sneaker:2.0.0'
androidTestImplementation
androidx.test.espresso:espresso-core:3.3.0'
}
buildscript {
ext.kotlin_version = "1.3.72"
repositories {
mavenCentral()
jcenter()
google()
}
allprojects {
repositories {
mavenCentral()
jcenter()
google()
}
}
You just add this line
maven { url 'https://jitpack.io' }
on code segment of your build.gradle (project) file.
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
jcenter()
}
}

Firebase Crashlytics vs Fabric Crashlytics

I was integrating Crashlytics following this article
https://firebase.google.com/docs/crashlytics/get-started
This is my project level gradle
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
// Add dependency
classpath 'io.fabric.tools:gradle:1.27.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// Define versions in a single place
ext {
// Sdk and tools
minSdkVersion = 16
targetSdkVersion = 28
compileSdkVersion = 28
// App dependencies
supportLibraryVersion = '27.1.1'
sqlbriteVersion = '0.7.0'
rxjavaVersion = '2.0.8'
rxandroidVersion = '2.0.1'
retrofitVersion = '2.3.0'
daggerVersion = '2.11'
playServicesVersion = '16.0.0'
constraintLayoutVersion='2.0.0-alpha2'
roomVersion = '1.0.0'
picassoVersion = '2.5.2'
flexboxVersion = '0.3.2'
firebaseMessagingVersion='17.3.4'
firebaseCoreVersion='16.0.6'
crashlyticsVersion='2.9.8'
}
This is my app level gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.seed.app"
minSdkVersion 17
targetSdkVersion 26
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//dagger
compile "com.google.dagger:dagger:$rootProject.daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.daggerVersion"
compile "com.google.dagger:dagger-android:$rootProject.daggerVersion"
compile "com.google.dagger:dagger-android-support:$rootProject.daggerVersion"
implementation 'com.android.support:multidex:1.0.3'
//firebase
implementation "com.google.firebase:firebase-messaging:$rootProject.firebaseMessagingVersion"
implementation "com.google.firebase:firebase-core:$rootProject.firebaseCoreVersion"
// Crashlytics
implementation "com.crashlytics.sdk.android:crashlytics:$rootProject.crashlyticsVersion"
}
repositories {
mavenCentral()
}
apply plugin: 'com.google.gms.google-services'
This is how I crash my application in the MainActivity.
Crashlytics.getInstance().crash();
I am unable to get any errors in my firebase console and get an error message in the log
2019-01-02 20:36:55.139 21274-21274/com.seed.app E/CrashlyticsCore: This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up,
install an Android build tool and ask a team member to invite you to this app's organization.
What has my crashlytics installation gotta do with Fabric?
I was able to get this to work by repositioning the apply plugins in my app gradle to
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'

Android App crashes when OneSignal push notifications are sent

Android app is crashing just after onesignal push notification is sent.
I am getting this error. Tried looking at other stackoverflow answers but it didn't help.
Please check the code (build.gradle) & error below.
Dont understant why is it not working :P
Please check the code (build.gradle) & error below.
FATAL EXCEPTION: Firebase-FirebaseMessagingService
Process: com.mario.childhood.game.videogame, PID: 30163
java.lang.AbstractMethodError: abstract method "void com.google.firebase.iid.zzb.zzd(android.content.Intent)"
at com.google.firebase.iid.zzc.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source)
at java.lang.Thread.run(Thread.java:760)
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.myapp"
minSdkVersion 15
targetSdkVersion 27
versionCode 3
versionName "1.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [onesignal_app_id: 'XXXX-310c-4776-ae83-XXXX',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: '22978XXXX'
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.anjlab.android.iab.v3:library:1.0.44'
testImplementation 'junit:junit:4.12'
implementation 'com.github.delight-im:Android-AdvancedWebView:v3.0.0'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
}
build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha09'
// 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://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
You forgot to apply the OneSignal gradle plugin. According to the documentation, you should add
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin: [0.10.1, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
to the very top of your app/build.gradle
When applied to your file, it should look like this:
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin: [0.10.1, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.myapp"
minSdkVersion 15
targetSdkVersion 27
versionCode 3
versionName "1.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [onesignal_app_id: 'XXXX-310c-4776-ae83-XXXX',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: '22978XXXX'
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.anjlab.android.iab.v3:library:1.0.44'
testImplementation 'junit:junit:4.12'
implementation 'com.github.delight-im:Android-AdvancedWebView:v3.0.0'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
}
One Signal cannot work on its on, You haven't read their documentation thoroughly. It need FCM to work. They have a plugin which will automatically add all the dependencies. Add this code to your app gradle
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.1, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}

Can't import any Firebase classes

Out of nowhere, I suddenly can no longer import or use any Firebase classes. The class names show up in intellisense, but when hitting tab to import, it inserts their fully qualified name, and an error in the class name.
build.gradle (app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 'android-P'
defaultConfig {
applicationId "com.opticalgenesis.lbp.dogg"
minSdkVersion 21
targetSdkVersion 'P'
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(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.0'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-ml-model-interpreter:16.0.0'
implementation 'com.google.android.material:material:1.0.0-alpha1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
}
apply plugin: 'com.google.gms.google-services'
build.gradle (project)
buildscript {
ext.kotlin_version = '1.2.41'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha16'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url="https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
small snippet
private fun setupModel() {
val builder = com.google.firebase.ml.custom.model.FirebaseModelDownloadConditions.Builder()
}
FirebaseModelDownloadConditions is not the only class that doesn't import, they all don't.
Any help is appreciated.
Thanks.

Android kotlin project build stuck on app:kaptDebugKotlin task

I have next issue during the project building process: build process just stuck on app:kaptDebugKotlin task.
My root project build.gradle:
apply plugin: "kotlin"
buildscript {
ext.kotlin_version = '1.1.2-2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
ext {
buildToolsVersion = '25.0.2'
supportLibVersion = '25.3.1'
runnerVersion = '0.5'
rulesVersion = '0.5'
espressoVersion = '2.2.2'
archLifecycleVersion = '1.0.0-alpha1'
archRoomVersion = '1.0.0-alpha1'
}
and the app build.gradle itself:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 25
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.test.roomtest"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'io.reactivex.rxjava2:rxjava:2.1.0'
compile "io.reactivex.rxjava2:rxandroid:2.0.1"
compile "android.arch.persistence.room:runtime:${rootProject.archRoomVersion}"
compile "android.arch.persistence.room:rxjava2:${rootProject.archRoomVersion}"
kapt "android.arch.persistence.room:compiler:${rootProject.archRoomVersion}"
}
repositories {
mavenCentral()
}
I tried to use different plugin versions but it didn't help. As for using Room seems it's not a problem because this example builds without problems. Will be very appreciate for any help.
Is this still an issue?
The same problem for me was resolved by just using the newest kotlin - 1.3.60.

Categories

Resources