Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Editing external libraries in Android Studio

I am using an image carousel library that I snagged off of github, but there are a few things I would like to change in the code. I have imported it using the compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+' command. Is that code available for me to edit somehow? Or is it downloaded from github every time I run my code?

like image 610
chargerstriker Avatar asked Feb 06 '18 03:02

chargerstriker


People also ask

Where can I find library on Android studio?

The android default libraries like appcompact, design support libraries are stored in your folder where you have installed the SDK, precisely <SDK FOLDER>/extras/android/m2repository/com/android . The 3rd party libraries are stored in . gradle/caches/modules-2/files-2.1 folder.


1 Answers

For this you need to import it as lib and modify as you like:

To import the library to Android Studio, there are two methods that can work.

Method 1:

  1. Open your project in Android Studio
  2. Download the library (using Git, or a zip archive to unzip)
  3. Create a folder "subProject" in your project
  4. Copy and paste the FreemiumLibrary folder to your subProject folder
  5. On the root of your project directory create/modify the settings.gradle file. It should contain something like the following:
include 'MyApp', ':subProject:FreemiumLibrary'
  1. gradle clean & build/close the project and reopen/re-import it.
  2. Edit your project's build.gradle to add this in the "dependencies" section:
dependencies {
//...
    compile project(':subProject:FreemiumLibrary')
}
  1. Edit your App Activities to extend AdsFragmentActivity instead of Activity.
  2. Edit the library if you want to use it with ActionBarCompat

Method 2:

  1. Open your project in Android Studio
  2. Download the library (using Git, or a zip archive to unzip)
  3. Go to File > New > Import-Module and import the library as a module
  4. Right-click your app in project view and select "Open Module Settings"
  5. Click the "Dependencies" tab and then the '+' button
  6. Select "Module Dependency"
  7. Select "Freemium Library" (not Freemium Library Project)
  8. Modify your App Activities to extend AdsFragmentActivity instead of Activity.
  9. Modify the library if you want to use it with ActionBarCompat
like image 131
Shailendra Madda Avatar answered Oct 05 '22 14:10

Shailendra Madda