Unable to add library to Android Studio project

Viewed 1650

I'm trying to add this library to Android Studio locally using this tutorial on YouTube.

However, I get errors that I can't post here because they're too many (99+).

Can someone tell me step by step (in detail) how to succesfully add this library to my project and be able to edit it afterwards?

This is the main error I get when I try to import this library: `Unable to determine constructor argument #1: missing parameter of type Factory, or no service of type Factory.

My 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:4.0.0"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"


        classpath 'com.github.dcendents:android-maven-plugin:1.2'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'

        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.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
}
4 Answers

Step by step description:

  1. Then ceck out the git project to your machine.
  2. Modify and build it with a new Version.
  3. Add the dipendency as Jar from Your local filesystem in Android Studio.

ddTry this: File > Project Structure > Dependencies Tab > Add module dependency (scope = compile)

Where the module dependency is the project library Android folder.

Or edit your gradle.build like in the picture:

enter image description here

Here is your step-by-step guide:

  1. Create an empty project or open your existing project where you want to add this library.

  2. Clone the library project from the git or download the zip and extract it in some other directory.

  3. Now, in Android Studio, go to File -> New -> Import Module.... Select the cloned/extracted library directory. Make sure the :placepicker module is selected for import. Then click Finish.

enter image description here

  1. Now copy two files bintray.gradle and install.gradle from cloned/extracted project root directory to your own project root directory. Add this point your project structure should look like this:

enter image description here

  1. Now open your project level build.gradle. Add ext.kotlin_version = '1.3.72' inside buildscript { and also add following dependencies:
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'

Overall, this will look like:

enter image description here

  1. Finally, go to File -> Sync Project with Gradle Files. It will take some time to download the missing dependencies and you have now successfully integrated the library within your project which is fully editable.

  2. Now to make this library work in your own app module, in the build.gradle file of your app module, add this inside dependencies section:

api project(':placepicker')

In build.gradle(Module.app) file add this.

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

let me knew if it's work.

Related