Exporting AAR. from an Complex Project - android

I have a problem about exporting AAR from my project. My project has 3 modules that included as library into the project. One of that modules is android project that contains the actual project.
That means when you run the whole project in AVD, project opens the module as I mentioned before. And the other modules related and connected with the main module as a network and opencv library.
My problem is: When I want to create ONE AAR. file that includes all modules inside, the android project creates AAR. file by module that means three different AAR. file for 3 different module.
Because of that I cannot add my whole project's AAR. file to another project.
There is way of creating AAR. file of whole project that includes all modules inside like opencv module, network module, for all modules?
My project build.gradle;
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
apply from: "$rootProject.projectDir/dependencyVersion.gradle"
ext.kotlin_version = '1.4.10'
repositories {
google()
jcenter()
maven {url 'https://maven.fabric.io/public'}
maven { url 'https://maven.google.com' }
maven { url "https://plugins.gradle.org/m2/"}
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.1'
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
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.17.0"
}
}
allprojects {
repositories {
google()
jcenter()
maven {url 'https://maven.fabric.io/public'}
maven { url 'https://maven.google.com' }
maven { url "https://plugins.gradle.org/m2/"}
}
apply plugin: "com.jfrog.artifactory"
apply plugin: 'maven-publish'
}
artifactoryPublish.skip = true
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my build.gradle. of the library module. Lets call it module1 where i want to merge all other two library module(module2, module3) into this module1.
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
version = rootProject.sdkVersionName
group = rootProject.mainLibraryGroup
android {
compileSdkVersion rootProject.compileSdkVer
defaultConfig {
minSdkVersion rootProject.minSdkVer
targetSdkVersion rootProject.targetSdkVer
versionCode rootProject.sdkVersionCode
versionName rootProject.sdkVersionName
// versionCode 1
// versionName "1.0.0(10)"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dataBinding {
enabled true
}
lintOptions {
abortOnError false
}
externalNativeBuild {
cmake {
path file('CMakeLists.txt')
}
}
sourceSets {
main {
// The libs directory contains prebuilt libraries that are used by the app's library defined in CMakeLists.txt
// via an IMPORTED target.
jniLibs.srcDirs = ['libs'] //'libs'
}
}
}
dependencies {
// implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(path: ':module2')
implementation project(path: ':module3')
implementation "androidx.legacy:legacy-support-v4:1.0.0"
//getting dependencies from dependencies.gradle file
implementation deps.crashlytics
implementation "android.arch.lifecycle:extensions:$versions.arcLifecycle"
implementation "com.github.bumptech.glide:glide:$versions.glide"
implementation "androidx.appcompat:appcompat:$versions.appcompat"
implementation "androidx.constraintlayout:constraintlayout:$versions.constraintLayout"
implementation "com.google.code.gson:gson:$versions.gson"
implementation "com.google.android.material:material:$versions.material"
implementation "com.squareup.okhttp3:logging-interceptor:$versions.okHttp"
implementation "androidx.exifinterface:exifinterface:1.3.0-alpha01"
implementation "com.google.android.gms:play-services-location:$versions.playServices"
implementation "com.google.android.gms:play-services-mlkit-text-recognition:$versions.playServices"
implementation 'com.google.guava:guava:27.0.1-android'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'org.jmrtd:jmrtd:0.7.18'
implementation 'net.sf.scuba:scuba-sc-android:0.0.20'
implementation 'com.madgag.spongycastle:prov:1.58.0.0'
implementation 'edu.ucar:jj2000:5.2'
implementation 'com.github.mhshams:jnbis:1.1.0'
implementation 'androidx.camera:camera-core:1.0.0-beta05'
implementation 'androidx.camera:camera-camera2:1.0.0-beta05'
implementation "com.airbnb.android:lottie:3.4.4"
def camerax_version = "1.0.0-alpha01"
implementation "androidx.camera:camera-core:${camerax_version}"
implementation "androidx.camera:camera-camera2:${camerax_version}"
implementation "androidx.core:core-ktx:1.3.2"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//RX
implementation "io.reactivex.rxjava2:rxandroid:$versions.rxandroid"
implementation "io.reactivex.rxjava2:rxjava:$versions.rxjava"
implementation 'org.jetbrains:annotations:15.0'
//image Cropping
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
}
repositories {
mavenCentral()
}
apply from: "$rootProject.projectDir/tools/artifactory/commonArtifactory.gradle"
I applied all of them. After that, i clicked the gradle in righ panel of Android Studi. And I selected the module1>other>assembleRelease. I gave me this error.
DSL element 'android.dataBinding.enabled' is obsolete and has been replaced with 'android.buildFeatures.dataBinding'.
Could not resolve io.reactivex.rxjava2:rxandroid:null

You need a fat-aar (An aar that includes all the others locally).
You can use something like kezong lib or cpdroid lib
Update:
Based on the snippet that you included in the question, I suggest to try the changes below:
In your root build-gradle file (I think that is the first snippet) you should add the below code:
dependencies {
classpath 'com.kezong:fat-aar:1.2.20'
}
In your library's build-gradle file you should add the
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.kezong.fat-aar'
and change the below dependencies section:
from
dependencies {
implementation project(path: ':module2')
implementation project(path: ':module3')
}
to
dependencies {
releaseEmbed project(path: ':module2')
releaseEmbed project(path: ':module3')
debugImplementation project(path: ':module2')
debugImplementation project(path: ':module3')
}

Related

Gradle dependencies not being downloaded in new project

I created a new project and am trying to include an external dependency: https://github.com/KirkBushman/ARAW
I expect that when I add a dependency to my app-level build.gradle and re-sync my project, that the external dependency gets downloaded.
This is a screenshot of one of my old projects' file structure:
And this is my current project:
Why aren't I getting the same "External Libraries" part in my new project? This is what my new project's build.gradle(app-level) file looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.sometimestwo.jumblev2"
minSdkVersion 26
targetSdkVersion 29
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 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment:2.1.0'
implementation 'androidx.navigation:navigation-ui:2.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.github.KirkBushman:ARAW:v1.0.0-rc01' // what im trying to include
}
This is the "top-level" build.gradle file in my new project:
// 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: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://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Why aren't I getting the same "External Libraries" part in my new project?
Immediately above the portion of Android Studio you show in those screenshots, you will find a drop-down or similar sort of selector.
Your first screenshot probably has that set to Project:
Your second screenshot probably has that set to Android, which is the overall default:
Switch the new project to the Project view, and you should see the External Libraries branch of the tree.

Unresolved dependencies in Android Studio project

Issue: I've recently updated/installed the latest version of Android Studio and I imported a little old project. When I sync the project I get these errors:
The errors are as follows:
Failed to resolve: com.google.android.gms:play-services-ads-identifier:12.0.1
Show in Project Structure dialog
Affected Modules: app
Failed to resolve: com.google.firebase:firebase-measurement-connector:12.0.1
Show in Project Structure dialog
Affected Modules: app
I tried to add all the necessary elements to the gradle and I tried installing Google Play Services in SDK. My project is imported from the Desktop.
This is my app/build.gradle:
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.0'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.albetaqasite"
manifestPlaceholders = [
onesignal_app_id : 'cc95bb51-0699-4309-9322-be8793d5e564',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE']
minSdkVersion 15
targetSdkVersion 29
versionCode 55
versionName "3.4.1"
multiDexEnabled true
dexOptions {
javaMaxHeapSize "4g"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
useLibrary 'org.apache.http.legacy'
}
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation files('libs/android-async-http-1.4.4.jar')
implementation project(':ColorDialog')
implementation files('libs/universal-image-loader-1.9.4.jar')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
//implementation 'cn.pedant.sweetalert:library:1.3'
implementation 'com.github.f0ris.sweetalert:library:1.5.1'
implementation 'com.google.code.gson:gson:2.3.1'
implementation 'com.google.android.gms:play-services:8.4.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup.okhttp:okhttp:2.+'
implementation 'com.squareup.okhttp:okhttp-urlconnection:2.+'
implementation 'com.google.android.gms:play-services-ads:8.4.0'
implementation 'com.google.android.gms:play-services-identity:8.4.0'
//compile 'com.google.android.gms:play-services-gcm:8.4.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.7'
implementation 'com.onesignal:OneSignal:[3.8.3, 3.99.99]'
// compile 'com.google.firebase:firebase-core:8.4.0'
}
apply plugin: 'com.google.gms.google-services'
This is my Project/build.gradle:
buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://maven.google.com" // Google's Maven repository
} }
}
dependencies {
}
P.S: I'm aware of the problem in android.com.support dependencies, when I change the compileSdkVersion and targetSdkVersion to 27 it works, but the gradle ones I couldn't fix, kindly share your knowledge and experience if you've ever encountered this or have any idea how to solve it.
I think you need to add entries for those dependencies down in the section near these entries:
implementation 'com.google.android.gms:play-services:8.4.0'
implementation 'com.google.android.gms:play-services-ads:8.4.0'
implementation 'com.google.android.gms:play-services-identity:8.4.0'
However, if you try to bring in version 12.0.1 of one library, and version 8.4.0 of another related library, you are probably going to have issues. See if you can bump up the version number of these three to 12.0.1

Android studio: Kotlin scope functions Unresolved reference. But Project compiles

I am facing this strange issue where my project compiles and runs successfully but in my kotlin scope functions red errors are coming. It also shows errors on some of the kotlin functions like toLong(), toDouble() etc.
and I have this in my gradle file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.xyz"
minSdkVersion 19
targetSdkVersion 28
versionCode 4
multiDexEnabled true
versionName "1.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
def lifecycle_version = "2.0.0"
def room_version = "beta01"
implementation fileTree(dir: 'libs', include: ['*.jar'])
//android X
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
implementation 'com.android.support:multidex:1.0.3'
api 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
api 'de.hdodenhof:circleimageview:3.0.0'
api 'com.jakewharton:butterknife:10.1.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
// For Kotlin use kapt instead of annotationProcessor
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.20'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
implementation "androidx.room:room-runtime:2.2.0-$room_version"
implementation "androidx.room:room-ktx:2.2.0-$room_version"
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
api(name: 'sdk-release-1.6.1', ext: 'aar') {
transitive = true
}
// Add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
//annotation processors
annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
annotationProcessor "androidx.room:room-compiler:2.2.0-$room_version"
// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
//facebook app events sdk
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
}
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
Gradle Properties
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
android.enableJetifier=true
build gradle
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20"
classpath 'com.google.gms:google-services:4.3.1'
classpath 'io.fabric.tools:gradle:1.31.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have tried Invalidate cache/Restart and also tried deleting .idea and .gradle files nothing helped, I have also tried to restart the android studio and also tried to change branches from git nothing helped.
any help appreciated.
I had similar experience on Android Studio with Kotlin since 2 weeks ago.
When I import a project on GitHub with old Kotlin plugin version 1.3.31. I quickly changed it to 1.3.72 (the latest kotlin) then, I had had this error too.
I could fix the error when I changed the plugin version to 1.3.61 (older version) and sync my project. It removed the error and update it to the latest plugin version 1.3.72. And everything worked smoothly now.
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
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
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0-alpha06"
}
}
I was like magic.
Just changed the Kotlin plugin version to a 2 or 3 older versions backward and sync your project. I should work
I hoped it helps
Change this line
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50'
Into
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.50'
And then do again, clean build then invalidate cache and restart.

Facing several errors while building the project in Android [duplicate]

This question already has answers here:
Android - Getting multiple errors while building the project
(2 answers)
Closed 4 years ago.
I am getting these errors after importing the android project
Failed to resolve: firebase-core
Open File
Failed to resolve: multidex
Open File
Failed to resolve: play-services-ads
Open File
Failed to resolve: play-services-auth
Open File
Failed to resolve: firebase-auth-license
Open File
Failed to resolve: common
Show in File
I am unable to know the exact reason of this issue. Please check.
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha09'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
maven { url "https://adcolony.bintray.com/AdColony" }
maven { url "https://dl.bintray.com/ironsource-mobile/android-sdk" }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app level build.gradle
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.test.android"
minSdkVersion 15
targetSdkVersion 26
versionCode 3
versionName "1.0.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
manifestPlaceholders = [onesignal_app_id : "65f11821-8462-4ec4-9e41-XXXXX",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "916XXXXXXX00"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// applovin
implementation project(':unity-ads')
//unity ads
//compile 'com.google.android.gms:play-services-ads:11.0.4'
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support:support-vector-drawable:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:26.+'
//implementation 'com.google.android.gms:play-services:11.6.0'
implementation 'com.android.support:multidex:1.0.1'
//compile 'com.github.cooltechworks:ScratchView:v1.1'//not used
implementation 'com.jackpocket:scratchoff:1.1.0'
implementation 'com.adcolony:sdk:3.2.1'
implementation 'com.android.support:support-annotations:26.0.1'
implementation 'com.google.android.gms:play-services-ads:11.6.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.facebook.android:facebook-share:[4,5)'
testImplementation 'junit:junit:4.12'
implementation 'com.ironsource.sdk:mediationsdk:6.7.0.1#jar'
//compile 'com.google.ads.mediation:unity:2.1.1.0' //not used
implementation 'com.google.firebase:firebase-database:11.6.0'
implementation 'com.github.bumptech.glide:glide:4.1.1'
implementation 'commons-net:commons-net:3.3'
//get server time
//compile 'com.github.instacart.truetime-android:library-extension-rx:2.0'
//compile 'com.github.instacart.truetime-android:library:2.0' // not used
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.google.firebase:firebase-core:11.6.0'
implementation 'com.google.android.gms:play-services-auth:11.6.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
implementation files('libs/applovin-sdk-7.7.0-javadoc.jar')
implementation files('libs/applovin-sdk-7.7.0.jar')
}
apply plugin: 'com.google.gms.google-services'
EDIT: Unfortunately, I've belatedly realized that this question was a duplicate. Please refer to the answer here instead. (I'm also leaving this duplicate answer text here for now - although it will probably eventually be deleted - to preserve the solution that the original poster marked as correct.)
Apparently, jcenter has started mirroring Google's repo. Try moving google() before jcenter() in the allprojects section of your project's build.gradle (like this):
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
maven { url "https://adcolony.bintray.com/AdColony" }
maven { url "https://dl.bintray.com/ironsource-mobile/android-sdk" }
}
Try another version of this APIs. And you should to declare constant version and use it like {$const} then your gradle will be less error prone about versions difference.

How do I solve this Implementation() error?

I'm getting an error whenever I run the implementation() method.
I tried to import this Insiteo '.aar' file and set it's dependencies, but there's an issue with calling 'implementation()' method. Help?
Insiteo module build.gradle:
configurations.maybeCreate("default")
artifacts.add("default", file('Insiteo-SDK-3.6.3g.aar'))
dependencies {
implementation 'com.squareup.retrofit:retrofit:2.0.0-beta2'
implementation 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
}
Here's the error
Error:(6, 0) Could not find method implementation() for arguments ['com.squareup.retrofit:retrofit:2.0.0-beta2']
App module build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
apply plugin: 'com.android.library'
defaultConfig {
applicationId "com.example.joey.projectgenesis"
minSdkVersion 26
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:gridlayout-v7:26.1.0'
implementation 'com.squareup.retrofit:retrofit:2.0.0-beta2'
implementation 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
implementation project(':Insiteo')
}
Project build.gradle:
// 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.0.1'
// 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
}
My Android plugin version is 3.0.1, and my Gradle version is 4.4.1
I've also tried compile() as well with the same error.
There isn't any problems with the other build.gradle scripts, just the Insiteo module script, and it's only with the implementation() method.
AFAIK, you can't add dependencies to an aar module like that. You most likely need to apply the app or library plugin in order to do that.
But it's generally easier just adding the dependencies directly into your project; not into the library module. Example:
Root /
app/
myAarLibrary/
Don't define dependencies in myAarLibrary, define them in app
Your gradle have some problem. You can use compile instead implelentaion in gradle dependencies. All gradle support this by default.
Make sure you are using Android Studio 3.0 or above.
Your app level build.gradle should look like this:
// 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.0.1'
// 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
}
Make sure your gradle-wrapper.properties looks like this:
#DATE
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
Use
implementation 'com.squareup.retrofit:retrofit:2.3.0'
implementation 'com.squareup.retrofit:adapter-rxjava:2.3.0'
implementation 'com.squareup.retrofit:converter-gson:2.3.0'
instead of
implementation 'com.squareup.retrofit:retrofit:2.0.0-beta2'
implementation 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta2'

Categories

Resources