6

I am sorry for asking this newbie question.

I am trying to use this library in my project: https://github.com/gfranks/GFMinimalNotifications

I would like to import the source codes and not the binary.

The github page says Simply copy the source/resource files from the library folder into your project.

So I tried to drag and drop these two files directly to my libs folder in Android Studio.

And I went back to my Activity and try to use it in my code. But the autocomplete does not seem to recognize the library.

Any help, please? After I copied into my libs folder.

Importing the whole module seems to be wasteful considering the project has many assets that are irrelevant to the library itself.

Found the solution

I copied it to the app/libs folder, and then in build.gradle I add

sourceSets {
    main.java.srcDirs += 'libs/GFMinimalNotifications/src/main/java'
}
Community
  • 1
  • 1
JayVDiyk
  • 4,277
  • 22
  • 70
  • 135

4 Answers4

9

Steps to add modules in Android Studio download zip file & follow steps

Follow Step first

Step second Step third Step fourth

Jared Rummler
  • 37,824
  • 19
  • 133
  • 148
Ajinkya
  • 1,029
  • 7
  • 15
  • 1
    This doesn't solve my problem but I'll reward the bounty and mark as accepted since it is the closer to the solution I end up using – JayVDiyk Dec 24 '15 at 04:49
  • I m getting a problem. it says that Error: Plugin with id 'com.github.dcendents.android-maven' not found. – Arpit Patel May 06 '17 at 03:54
  • @ArpitPatel - Check it once you are importing some other directory, not a library. – Ajinkya May 07 '17 at 16:03
  • it is a library (pdfViewr) and I solve it this error by adding a classpath in project level gradle. – Arpit Patel May 08 '17 at 02:57
6

copy in project full package library

in settings gradle add include ':library',':app'

in build.gradle

dependencies {
    ...
    compile project(':library')
}

enter image description here

PeDuCKA
  • 553
  • 3
  • 13
1

Simple step

  1. Download full project from git and extract.
  2. In android studio File -> New -> Import Module -> Browse directory you extract project.
  3. Resync Gradle.
JayVDiyk
  • 4,277
  • 22
  • 70
  • 135
Marco Luongo
  • 397
  • 4
  • 13
  • Virus the answer says I would like to import the source codes and not the binary. – Marco Luongo Dec 20 '15 at 11:51
  • It would be to big of a size because in that project it has many samples and other assets which is not needed in my project. Thank you for answering though. – JayVDiyk Dec 23 '15 at 06:11
  • When import module AS ask if you would import :library and :sample, just uncheck sample and use only :library project with all source code as you needed – Marco Luongo Dec 23 '15 at 08:54
0

there is two way to use this we ll use 2nd method Use binary approach

  1. Copy com.github.gfranks.minimal.notification-1.0.aar into your projects libs/ directory.

  2. Include the following either in your top level build.gradle file or your module specific one:

    repositories { flatDir { dirs 'libs' } }

  3. Under your dependencies for your main module's build.gradle file, you can reference that aar file like so: compile 'com.github.gfranks.minimal.notification:com.github.gfranks.minimal.notification-1.0@aar'


after do above step try to sync gradle if there is issue like

Suggestion: use tools:overrideLibrary="com.github.gfranks.minimal.notification" to force usage

then add below code in android manifest file

add below line in side manifest TAG

xmlns:tools="http://schemas.android.com/tools"

add below line above Application TAG

<uses-sdk
        tools:overrideLibrary="com.github.gfranks.minimal.notification"/>

finally your manifest look like

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.test" >


    <uses-sdk
        tools:overrideLibrary="com.github.gfranks.minimal.notification"/>

    <application... >your all code </application></manifest>
Dhaval Parmar
  • 18,812
  • 8
  • 82
  • 177