I have modified library project of finestwebview here
I tried to add this library project in to my android studio's project but I got several errors saying configuration with name 'default' not found android studio.need help. I wasted my 1 whole days trying this but unable to add.
what I tried is
I copied the library project into the libs folder of my root project,and added 'include:libs:finestwebview' in setting.gradle file.
Also going to
file->project structure->app->dependencies
added the module and sync the project but cannot achieve the desired outcome.
You are including a project, so for that you should add it as a module, and say compile project in your app's gradle dependencies to use it in your app module.
go to
File->New->Import module and add your library project folder
you will have to name your library project there
then you need to say
`compile project(':yourlibraryProjectname')`
in your gradle dependency
Related
I am trying to achieve the following project structure in Android Studio
project/
projectA/
projectB/
Where projectA is an "app" module created by Android Studio which I have renamed, and projectB is a Kotlin project I wish to depend on in the app. I can get the projects to appear correctly as modules in my project however no matter what I try, as soon as I add projectB to my Android Studio project, it seems to get stuck in a loop "searching for files to index". When I look at the files it is always just looping through the same 2-3 files. They are always META-INF files but not always the same ones.
How do I successfully add a module to an Android Studio Project without hitting this error or how can I set out my project from the start to achieve this structure?
Thanks.
The problem seemed to be that I had a gradle/ directory under my project/projectB directory that was there because the project was originally created as a standalone project by IntelliJ. Deleting that fixed the issue.
When I was trying to solve an issue with Android Studio I accidentally deleted .Gradle folder at the top of the project and build.gradle from within the app. I will post a screen shot of my project in Android Studio. The build tab also produces "make module my app project name" and "deploy module to app engine". The usual clean project, rebuild.... are not there.
How can I restore them?
If your are not using a VCS:
try use the local history to recovery the build.gradle file in your root folder (right click on the root folder)
If it fails. you can create a new project and copy the build.gradle. Usually this file contains generic info (like android gradle pluging and the repos to be used in the modules)
the .gradle folder is not a problem. Gradle wrapper will recreate this file
I copied both from a different project and pasted them in my project. That didn't solve the problem and I imported the project File->new->import project but that only created a duplicate within my project. I closed the project and deleted it from the list of project in Android studio. Then I created a project by importing it from Android Studio Projects folder. It took forever stuck in the gradle build and I have to restart AS manually. Now I have all my files and the project is compiling as it should.
You just need to reimport your project it will by default create the new gradle folder
In trying to get the hang of Fragment, I imported into Android Studio 1.5.1 the unzipped folder FragmentBasics after extracting the downloaded file FragmentBasics.zip to that Folder.
Now I have Gradle problems and I have no clue what to do to be able to run the app. I don't know that the .zip file is from Eclipse as the message suggests.
I did move the folder FragmentBasics to C:\Users\Dov because of the space in "Google Drive" but got same error.
Gradle project sync failed . Basic functionality (e.g., editing, debugging) will not work properly.
Failed to sync gradle project 'FragmentBasics'
Error:Cause: failed to find target with hash string 'android-15' in: C:\Users\Dov\AppData\Local\Android\sdk
Open Android SDK Manager
ECLIPSE ANDROID PROJECT IMPORT SUMMARY
Risky Project Location:
The tools should handle project locations in any directory. However,
due to bugs, placing projects in directories containing spaces in the
path, or characters like ", ' and &, have had issues. We're working to
eliminate these bugs, but to save yourself headaches you may want to
move your project to a location where this is not a problem.
C:\Users\Dov\Google Drive\AndroidStudioProjects\FragmentBasics
-
Replaced Jars with Dependencies:
The importer recognized the following .jar files as third party
libraries and replaced them with Gradle dependencies instead. This has
the advantage that more explicit version information is known, and the
libraries can be updated automatically. However, it is possible that
the .jar file in your project was of an older version than the
dependency we picked, which could render the project not compileable.
You can disable the jar replacement in the import wizard and try again:
android-support-v4.jar => com.android.support:support-v4:18.0.0
Moved Files:
Android Gradle projects use a different directory structure than ADT
Eclipse projects. Here's how the projects were restructured:
AndroidManifest.xml => app\src\main\AndroidManifest.xml
res\ => app\src\main\res\
src\ => app\src\main\java\
Next Steps:
You can now build the project. The Gradle project needs network
connectivity to download dependencies.
Bugs:
If for some reason your project does not build, and you determine that
it is due to a bug or limitation of the Eclipse to Gradle importer,
please file a bug at http://b.android.com with category
Component-Tools.
(This import summary is for your information only, and can be deleted
after import once you are satisfied with the results.)
I installed sdk 15 but then had problems with Gradle griping about
gradle-wrapper.properties file having a line with
gradle-2.8-all.zip that needed to be changed to
gradle-2.1-all.zip, so I edited gradle-wrapper.properties file to contain 2.1 instead of 2.8.
Message said after making change, re-import project. And it works.
Before importing I only removed following line from AndroidManifest.xml
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15" />
Worked with FragmentsBasics.zip in Android Studio 2.3.3
Why does Android Studio download gradle every time I try to import a new project?
Initially, I imported one gradle project for which Gradle 2.1 was auto-downloaded. Subsequently, for a second project import, it downloaded Gradle 1.10. Now again while importing a third project, it has downloaded Gradle 2.2.1.
What is happening?
Projects can declare which Gradle they require to run (see gradle.properties file in gradle directory in the root of the project).
Android Studio uses this information to download and run the right version (it's actually not Android Studio, it's the Gradle Wrapper running inside it). And it's a good thing.
What you can do?
Wait. Once you have the version downloaded in ~/.gradle directory, it will be used for any project declaring the same version. It's one-time cache.
Disable the usage of the wrapper when you import the project. I really recommend against it! You project might not build because of that.
Same happens to me.
The answer of JBaruch is allright.
1.- When you're opening a file on the option Gradle project: select the build.gradle that cames on your project
2.- Select the option "Use local grade distribution" and in Gradle home option; go and select in C:\Program Files\Android\Android Studio\gradle\gradle-2.2.1
It will not ask you to download it again (except if needs other version)
...well, here's what I normally do to speed up the initial build on opening a project (target):
1- open a project you already have working and open the file gradle-wrapper.properties a copy the following line (your project most likely will have a different version):
distributionUrl=https://services.gradle.org/distributions/gradle-6.7-bin.zip
2- paste it and replace the code on the same file on the target project
3- open the file build.gradle (project code) from a project you already have working and copy the following classpath, (again, your project most likely will have a different version)
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0-alpha15'
// ...
}
4- paste it on the same file on the target project
This way you can speed up the build of the target project while avoiding the usual 100Mb or so Gradle download.
Basically it downloads the Gradle build files for your current project according to its version and this whole work is done by your gradle wrapper which actually looks towards the basic requirement for your project and downloads the files according to that so whenever you are going to use any another projects of same version or with same requirements then it will not download any additional file at that time.Its just a one time shot!!!!
It usually downloads the Gradle updated version & and external dependencies for each project rather than fetching it from the cache.
So follow these steps:-
Go to settings
Search for Gradle
Untick Download External Dependencies Option.
I am trying to add the project https://github.com/passsy/android-HoloCircularProgressBar as a library to my project using android studio. I have added the project as a module and loaded it into the build.gradle file and added the dependency as well.
dependency {
compile project(':HoloCircularProgressBar')
}
No matter what it won't be able to find the attr 'cicularProgressBarStyle' and even in the xml it says unable to locate class file.
Would appreciate any help on this matter.
Thank you.
To import this plugin in Android Studio, complete the following steps:
Download the latest version of the plugin and extract the library directory
(rename it if you want - I've called mine circularProgressBar)
Create a new directory called libraries at the root of your project in Android Studio
Put the previously extracted library directory into into the new libraries directory
Go to your settings.gradle (also at the root of your project) and add the following:
include ':libraries:circularProgressBar'
Now go to File > Project Structure, select your module and click on the Dependencies tab, then click '+' and select 'Module Dependency'. You'll be prompted to select the holoCircularProgressBarModule. Select it and click OK.
Do a Gradle Sync and the project should be successfully imported.
This was completed using Android Studio 0.5.8