Unable to load library for dependecy project in android studio - android

I am migrating a big project that contains more than 5 dependency libraries from Eclipse to Android Studio.
I ain't able to run compile
'com.google.android.gms:play-services:8.3.0' if I put
com.android.library but able to run by setting it to
com.andriod.application.
Please Help
here is the screenshot

Your gradle file starts like so:
apply plugin: 'com.android.application'
apply plugin: 'com.android.library'
and in "dependencies" you place your dependency:
dependencies {
compile 'com.google.android.gms:play-services-gcm:8.3.0'
}

Related

recyclerView - unresolved reference error in Android Studio using Kotlin

The plugins mentioned below are there in the gradle file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
the following dependency is also added in the same
implementation 'androidx.recyclerview:recyclerview:1.1.0'
Added this one as well;
implementation 'com.android.support:recyclerview-v7:25.3.1'
the error is appearing when I am writing recyclerView in the OnCreate Funtionenter image description here
Could you please suggest, how the error can be resolved.
do check the apt version of rein the
app-> project structure-> dependencies-> + symbol -> library dependencies
try it

Butterknife fails with Gradle plugin 3.0

I was using Butterknife in my project and after updating Android Studio and Gradle plugin to version 3.1.2, I can not continue using Butterknife.
Has anyone faced this problem and resolved it?
I have considered eliminating Butterknife and using Android Data Binding, is it a good option?
Just Add this dependency in your app.gradle file .its work fine with Android studio 3.1.2 .may be you have some other problem with gradle.
New Approach
In app.gradle
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
In project.gradle
classpath 'com.android.tools.build:gradle:3.1.2'
If you use these plugin in app.gradle then Remove these lines.
Old Approach
apply plugin: 'com.android.library'
apply plugin: 'com.jakewharton.butterknife'
project.gradle
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
I think,there is some other problem please use this dependency.
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'

'Unresolved reference' errors for android library module referenced in app module

I have problems referencing my android library modules in my projects. Beside the main app module I use to have an android library module with either util stuff or as data module. I reference it in app module like that:
dependencies {
implementation project(":data")
}
When I build the project, it´s giving me lot of error messages 'Unresolved reference: ...' for all stuff that I reference in the app module to the android library module. But the IDE itself doesn´t have a problem, Intelligent finds all classes, interfaces etc., imports are fine, nothing is red. The android library module itself builds and creates aar-file in the output. It´s the compileDebugKotlin task that fails
Any general idea what may be related to that?
Found the problem, my android library module was missing the kotlin configuration:
apply plugin: 'kotlin-android'
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion:<version>"
}
Although I used kotlin .kt files in it, it could build without and also
Tools -> Kotlin -> 'Configure Kotlin in projects'
had told me 'All modules with Kotlin files are configured'
Your module's build.gradle file should have:
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
dependencies {
...
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
...
}
In my case It was apply plugin: 'kotlin-android',
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
and also added it on build.gradle
androidExtensions {
experimental = true
}
If it is a kotlin module make sure to add in its build.gradle file
apply plugin: 'kotlin'
I was using CoroutineWorkers and in my case I had to add work-runtime-ktx dependency to use it
implementation "androidx.work:work-runtime-ktx:2.4.0"

Android app with firebase implementation

How to fix "Could not find com.google.gms:google-services3.0.o " Even after adding json file andgoogle-services.json file applying plugin for it
This is where i applied plugin for google services
[Classpath dependencies][3]
add this in your project module gradle
classpath 'com.google.gms:google-services:3.0.0'
add dependencies
compile 'com.google.android.gms:play-services-auth:10.2.0'
}
apply plugin: 'com.google.gms.google-services'

Gradle DSL method not found : testCompile()

I am using gradle version - 3.3-all and gradle plugin - gradle:2.3.3
I want to write test cases. So as per this page, I included the following in the the app's top build.gradle file.
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
But I get the error saying
Error:(11, 0) Gradle DSL method not found: 'testCompile()'
Possible causes:<ul><li>The project 'TopLevelProject' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
What could be the issue?
Add the Java plugin
apply plugin: 'java'
In gradle the configurations: compile runtime testCompile etc are coming from java plugin
But in android i think you need apply plugin: 'com.android.application'
Edit: Please share your root build.gradle and app build.gradle especially android closure, dependencies and plugins and describe which is where.
Sometimes is a structural problem and app related stuff lands in root build.gradle
I don't have the reputation to comment, so I post this as an answer.
I had a similar problem, try applying the Java plugin and the testCompiles in the app's build file, that is in: project/app/build.gradle, not the project's build file.
apply plugin: 'com.android.application'
dependencies {
...
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
}

Categories

Resources