Edit Classes From Github Libraries - android

I have installed the folder picker as per instructions from Github found on this link: https://github.com/kashifo/android-folder-picker-library
I have added the following line to gradle:
implementation 'lib.kashif:folderpicker:2.4'
And added to MainActivty:
import lib.folderpicker.FolderPicker;
And in onCreate:
Intent intent = new Intent(ActivityFolder.this, FolderPicker.class);
startActivityForResult(intent, PICKFILE_REQUEST_CODE);
Everything works fine accept that this type of installation seems to be working 'online' as I don't understand where this class is: FolderPicker.class, I would like to make changes to it and its xml layout (remove the New button etc..), how can I edit this library and customize it instead of using it as it is?
I have also downloaded the entire package as well and it also doesn't have all classes and layouts located within the app folders.

You are looking in to wrong folder , The app folder is for the sample project . The actual library will be in folder with name folderpicker
Here is the link to the class FolderPicker.java .
If you want to customize the library then clone the project , edit the parts you want in folderpicker and include the the folderpicker module to your project Or generate an aar file and add aar file in the project . If you have time you can even publish on jcentre/maven and directly include it as a gradle dependency

Follow This Steps For Import Module and Edit Libraries class in Android Studio.
First Download Project From Github Then Go to Android Studio-> File -> New -> Import Module...
Select the source directory of the Module you want to import and click Finish.
Open Project Structure and open Module Settings for your project.
Open the Dependencies tab.
Click the (+) icon and select Module Dependency. Select the module and click Ok.
Open your build.gradle file and check that the module is now listed under dependencies.(implementation project(path:":YOUR_PROJECT_MODULE_NAME")

Related

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?
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:
Open your project in Android Studio
Download the library (using Git, or a zip archive to unzip)
Create a folder "subProject" in your project
Copy and paste the FreemiumLibrary folder to your subProject folder
On the root of your project directory create/modify the settings.gradle file. It should contain something like the following:
include 'MyApp', ':subProject:FreemiumLibrary'
gradle clean & build/close the project and reopen/re-import it.
Edit your project's build.gradle to add this in the "dependencies" section:
dependencies {
//...
compile project(':subProject:FreemiumLibrary')
}
Edit your App Activities to extend AdsFragmentActivity instead of Activity.
Edit the library if you want to use it with ActionBarCompat
Method 2:
Open your project in Android Studio
Download the library (using Git, or a zip archive to unzip)
Go to File > New > Import-Module and import the library as a module
Right-click your app in project view and select "Open Module Settings"
Click the "Dependencies" tab and then the '+' button
Select "Module Dependency"
Select "Freemium Library" (not Freemium Library Project)
Modify your App Activities to extend AdsFragmentActivity instead of Activity.
Modify the library if you want to use it with ActionBarCompat
I solved this way. Fork library project. Then clone it (In Android Studio, File -> New -> Project from Version Control -> put the link of your repository that you forked and open it). Edit it and commit it to your master branch. Then push it to your master branch. And finally find snapshot version of that library. For example if you use JitPack. Go to jitpack.io website and search for your repository (forked version with your username). And there go to commits section and get latest version that you committed. And use that library dependency in your project instead of original repo.
My approach was similar to #Shailendra Madda's with some minor differences.
At first I downloaded/cloned the project in my PC. Let's say the library's name is 'VideoPlayer'.
I ensured that the module level gradle of VideoPlayer did not contain applicationId. I also ensured that it contained
plugins {
id 'com.android.library'
}
instead of
plugins {
id 'com.android.application'
}
Now the library is ready for import.
In order to import this library into my project, I went to File -> New -> Import Module.
From there, I selected the directory of VideoPlayer. The VideoPlayer project that I downloaded had four modules. In cases like this you can simply select the modules you want to import. I selected the module named core and clicked finish. [Note: instead of selecting VideoPlayer folder from the explorer, you can also select the 'core' folder].
After importing the module, go to File -> Project Structure (or Ctrl+Alt+Shift+S) and select dependencies. From modules section, select app (here, app is the name of my project's module) and then select the + icon in 'declared dependencies' section and select Module Dependency. From the new window, select the module you wish to add as dependency (in my case, it is 'core').
After you click Apply and/or OK, android studio will modify relevant gradle files, so you don't have to worrry about it. And the project will be added as a dependency in your project.
Check this page to learn more: https://developer.android.com/studio/projects/android-library

Android Studio project cloned from Github only showing ReadMe

I'm trying to set up my Android project on my new laptop and I'm having some trouble. My project works fine on my PC, it's just the new setup I can't get working right. The project file is building properly, but it won't display in the project view. The files I can open show a red J in a circle. All attempts to update or pull just end in "All files up to date."
This is a link to my github profile: https://github.com/jschioppo/RecipeList
I have downloaded this project and found that there are no project level build.gradle and settings.gradle files.
This is not an Android project it's a module. I am able to run this Module at my end. Do following steps:-
Create new Android project in your studio.
Once it is loaded. Goto File Menu and Click on Import new Module.
If you already have a Module named app then changed the Module name and import this Module.
Now you will be able to run this Application.
You've not added project's build.gradle (located in project's root folder) to your github repo. Please add that to github and try importing again.

Import parse.com library into Android studio 0.8.2

I'm trying to import the Parse-1.5.1.jar file into my project in Android studio following these steps:
- File -> Project structure
- Click on the plus button and click on Import .JAR or .AAR package
- Choose my jar file and then hit finish
But then any command from the parse library is recognized. For example : "Cannot resolve symbol ParseObject" and android studio doesn't propose me to import anything.
I can't find on stackoverflow any instruction for these version of Android studio and Parse.
Any suggestion ?
Today i too started with Parse. All you need to do is:
Copy the parse-1.5.1.Jar file (Ctrl+c) and paste it in app->libs folder
Ensure build.gradle inside the app folder contains this line: compile fileTree(dir: 'libs', include: ['*.jar'])
That's it. You just need to click on Sync Project with Gradle Files button on the top to rebuild your project. You'll now be ready to use the classes from the Parse Library.
Hope this helps. All the best
Take your Parse-1.8.4.jar file and copy and paste it into your libs folder.
Then make sure your manifest has all the correct permissions. Here is some, but there are more permissions than this:
Make sure you have the parse class that extends Application and calls Prase.initialize in onCreate().
Then go to File -> Project Structure. In the pop-up, select "app" -> "Dependencies" tab -> Click on the plus sign and select "File dependency". Then select your "Parse-1.8.4.jar" file.
Firstly open your project libs file. Download parse example project code from https://www.parse.com/tutorials#android . opy the libs file.Paste them to your project file/libs file.Click File in android studio and then click project structure tab or hit the F4 if its work. And click "app" left side of tab in opened window.Then Dependencies tab. Click "+" on right side. Click File Dependency and click libs and find the Parse.xxx.jar file and click OK and Apply . Tahts it. And you can also take look here https://www.parse.com/tutorials#android.

How to import external library in android studio?

I struggle to import library 'PageSlidingTapStrip'(https://github.com/astuetz/PagerSlidingTabStrip).
I found this question(How to import eclipse library project from github to android studio project?), and I follow this solution.
cf)I'm using win 8.1 , android studio version 0.3.6
First, build new project like this condition.
Second, go to File -> New Module click, create new module as android library and make condition like this.( Unchecked create custom launcher icon, activity )
And this part I got a first question. Which version should I choice version about 'Minimum required SDK' , 'Target SDK', 'Compile with'? Just Follow project version? (image show default value when I create this window first.)
Anyway, I progress under condition ' Minimum required SDK : API 9 / Target SDK : API 19 / Compile with : API 19 '
Third, delete files under 'Project/PageSlidingTabStrip/src/main/' and copy folder&file under external library 'res', 'src', 'AndroidManifest.xml' and move into 'Project/PageSlidingTabStrip/src/main/' then renamed src to java.
And then project & folder become like this. (what I followed question as , told me copy and move file 'ic_launcer-web.png' apart from 'res', 'src', 'manifest' , but I can't find that file)
Fourth, go to 'File -> Project setting -> Module -> click project module -> '+' button -> select Module dependency' then apply.
After that, I face this error and cannot resolve R.
And I can't go next step, can't finish import library.
What should I do?
Is there any other solution?
Thanks for seeing long question. I hope to get a solution!
I also use the PagerSlidingTabStrip Project in my app and everything works fine.
I'm not sure if it's already possible to add a library project via the IDE (-> without any problems).
Please try to add the library project by editing the gradle files like this:
first delete your module PagerSlidingTabStrip
then create a folder in your root project directory (-> NewOne) named 'libs'
copy the complete folder 'library' of the PagerSlidingTabStrip project on git into 'libs'
rename the folder 'library' that you just copied to e.g. "PagerSlidingTabStripLibrary" (just to avoid confusion) -> after the renaming you should have the path: "NewOne/libs/PagerSlidingTabStripLibrary"
now add this library in your settings.gradle with the following command:
include ':libs:PagerSlidingTabStripLibrary'
go to your build.gradle file of your AppProject aps and add the following line to your 'dependencies':
compile project(':libs:PagerSlidingTabStripLibrary')
at least you have to sync your gradle files: Tools -> Android -> Sync Project with Gradle Files
Please try this. If you get errors please post the log file.
For update up to Android Studio 1.2.1.1
There are basically three types of dependencies which we have to add in project of android Studio
Add Normal Dependencies like Support files
Right click on project->open module settings
Select dependencies->Now press right "+" icon button ->Select
library Dependencies
Enter Name and Search
Select file and press ok button.
Add Git Hub Dependencies
Find the dependencies of git repository for example compile 'com.jakewharton:butterknife:6.1.0' from https://github.com/JakeWharton/butterknife
A. open build.gradle(module:app) file
B. Add lines compile 'com.jakewharton:butterknife:6.1.0'
OR
Follow as describe above in Normal Dependencies Step by just enter dependencies in search bar
Add Jar files Dependencies
Right click on project->open module settings
press left "+" icon (insert new Module) button -> Select import Jar or .AAR package->browse Jar file and finish
Now select dependencies-> press right "+" icon button ->Select module Dependencies->select jar files->press ok button.
For what it's worth I had this problem and eventually solved it by consistently using the same sdk version & build tools across projects.

How to import eclipse library project from github to android studio project?

I want to use HoloCircullarProgressBar as a library project in my android studio project.
I tried to do it by copying into pre-created "library" folder in my project and then to add it to project in "Project Structure". But it's not working somehow.
Could anyone give a very specific step-by-step tutorial on how to do that in android studio 0.3.6?
If you're importing a library as source code into a Gradle-based project, then at the moment there's no super-easy way to do it (sorry, it's on the to-do list, see https://code.google.com/p/android/issues/detail?id=62122) so you'll have to author your own build file for the library. Actually, it might be easier to use the New Module wizard to set up the build file and directory structure, then you can trim it down and copy the files over. This set of steps should get you up and running. It seems like a lot of steps but it should hopefully go pretty quick.
From the File menu, choose New Module...
From the wizard that comes up, choose Android Library
From the next page of the wizard, give it the module name HoloCircularProgressBar, and uncheck the options for Create custom launcher icon and Create activity.
Click Finish on the wizard.
It should add the new module to your project, so you'll end up with something like this:
Delete everything inside the src/main folder.
Now copy AndroidManfiest.xml, ic_launcher-web.png, res, and src from the HoloCircularProgressBar source into the src/main folder.
Rename the src folder that you just copied into src/main to java.
The New Module wizard left some things in the build.gradle file in your HoloCircularProgresBar module/directory (make sure you're editing that one, not the one for your main app module) we don't need. Remove the dependencies block and the release block.
At this point you should hopefully be able to build successfully. Now if you want to actually use the module:
Go to File > Project Structure... > Modules > Your main module > Dependencies.
Click on the + button to add a dependency, choose Module dependency, and select HoloCircularProgressBar from the list.
Now import statements and usages of the library should work, and you should be good to go.

Categories

Resources