I fairly new to android studio and I've been trying to implement this github project as a library by creating a directory called libraries and copying the CustomGauge folder to it. Then updating the settings.gradle and dependencies section of the app. Then I added the specified code to content_main and get the following errors. Any help would be greatly appreciated.
File >> New >> Import Module and load library project , it will be import to your project as a module, and will be add one gradle file under Gradle Scripts.
Sync project with Gradle Files and you are good to go.I hope it will be Ok for you. I tested on Android Studio 2.0 Preview 5
Related
Finally I thought of migrating my android project from Eclipse to Android studio. But importing the project by generating gradle build file from eclipse wasn't helpful. The project structure is as in figure and these are the things I followed:
Generate gradle build file of project in Eclipse. Import Eclipse ADT project. As, you can see from figure Android-project is my main project containing manifest file and resources.
The barcode-common and common contains java classes which are required in main project(i.e. Android-Project). So, I created module or import existing module in Android Studio. In settings.gradle of main-project I written as
include ':app', ':common', ':barcode-common'
And in build.gradle of main-project as
implementation project (':common')
implementation project (':barcode-common')
This works fine. But I dont want common and barcode-common to be inside main-project as I want to maintain the project directory as in figure. So, in settings.gradle of main-project I written as
include ':app', ':common'
project(':common').projectDir= new File('..\\common')
In this case I can't import any java class from common or barcode-common to main-project. Its not recognizing the java class.
So, any alternative or solution for this will be very helpful. I am struggling on this. Thanks
P.S: I want to maintain the project structure as shown in figure as common and barcode-common files are even shared by another project.
I downloaded the Navigation Drawer demo described in the docs that is (as of this writing) available here: http://developer.android.com/shareables/training/NavigationDrawer.zip
The zip file for this project does not contain a build.gradle file and seems to use a different structure than is conventional. My guess is that this an old project but I want to build and run it in Android Studio 2.x (currently 2.2.3). Since this is part of the official documentation I guess I might be doing something wrong, or did the creator of this file intend for me to create a gradle build file on my own?
Any help for getting this running?
Whenever you import an Android project you should essentially go to menu File > New > Import Project. As a result, it will automatically create a build.gradle file in case it does not exist in the project.
I'm using Android Studio 2.3.
Hope it helps :)
Delete all gradle related files out side your app folder and import project again it will rebuild and it will include all gradle related dependencies again
I am trying to import an android project created in eclipse into android studio. This main project also refers to another library project in the same eclipse workspace. The folder structure is like this:
workspace\app1
workspace\lib1
When I import the main project into android studio, the library project is automatically imported as a sub-project (or shall we call it a module) within the main project. That's not what I want. The library project is shared by multiple apps I am maintaining. It should sit in parallel with other app projects in terms of folder structure. I wouldn't want it to go understand any particular app project.
Please help explain how I can make the library project stand its own and refer to the library project from other app projects in android project. I am fairly new to the gradle build system. So detailed instructions would be highly appreciated. Thanks a lot!
Since you are importing in android studio, I assume you are moving to gradle build system. In your case , I think, it would be best to have a separate AS project for library. Use that project to generate a jar file and then import that jar using gradle build script in each project you want to use it.
If you are sharing the same library across multiple, you can configure them as separate AS project and have "aar" file as output. (In your gradle you put>> apply plugin: 'android-library'). You then define them as dependency in your gradle file. (either through maven repo or putting it in your libs directory and defining it in your dependencies section). You can find more info at http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Library-projects
You can use version control tool such as git to synchronize the library project in every main project. But you need to use a version control tool to manage all your projects first.
Read here on "AS Modules"
review 57.1.2 on "common behavior"
Take a look at a project built on AS pattern of modules as libs used in eclipse (gradle.settings) pictured
all the includes are modules
maybe you can rethink the idea of how to get AS to work for you in reusing code....
First of all I'm new to Gradle and I've a limited knowledge in it.
I've an android project. What I need is to integrate a Gradle library project with my project.
So my question is, IS it possible to add Gradle library project with an android Project without converting the android project to Gradle Project???
Can any one Help me to find the solution? I'm using eclipse as the tool.
Thanks in advance!!!
Yes. you can do it
Try these methods
Method1: Manually reconfigure your gradle based library project folder structure like your regular eclipse projects
Method2: Import project then Properties > java build path > source tab....remove path to src....add path to java folder in the source code using add folder button... then build your project as usual
Novice question.
What is the recommended way to run the sample apps, included in the Facebook SDK, in Android Studio (0.8.6)?
The ideal answer would include step-by-step instructions.
I'm using Android Studio version 0.8.0, and Facebook SDK 3.18.
When I tried to open a sample as a separate project, it can't find Gradle and wasn't able to run it. However, when I imported /samples folder as a root, all sample projects were imported and was able to run each samples.
File > Import Project > Select FACEBOOK_SDK_PATH/samples > OK > Create project from existing sources
and then, click next/ok as Android Studio's default setting.
Hope it helps!
Suposing you already downloaded and unzipped the SDK.
Create your android project. Gradle based.
File -> Import Module. Navigate to the unzipped folder and select the unzipped folder.
Add the library dependency in your main module (the one created with your project) adding this line in your build.gradle:
Synchonize project.
If you want to continue creating your own app, you might add the dependency module build.gradle file:
android {
dependencies {
compile project (':facebook')
}
}