w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to setup and test an Android Library Project with Gradle and Android-Studio?
i think this tutorial will help you : http://cyrilmottier.com/2013/06/27/a-productive-android-development-environment/ !

Categories : Java

Android Studio & Gradle: Add outside java classes to Android main project
you might want to make your Dir a own module add include 'Dir' to your settings.gradle create a build.gradle inside your Dir directory with this content apply plugin: java now you can go into your main projects build.gradle and add to dependencies: compile project(':Dir') if your Dir uses android related stuff, you might want to use the New > Module(right click on your project in Android Studio) Function of Android Studio to create an Android Library. But i haven't tested that feature yet. If Android Studio throws an Exception when trying to use the New Module, you should try to update Android Studio, in the latest Version it works for me. You might also want to check the Gradle User Guide and the DSL Reference both are very helpfull in getting into Gradle and understanding i

Categories : Java

Automatically versioning Android project from git describe with Android Studio/Gradle
After some further reading and several false starts, I ended up with this, added to the bottom of build.gradle in the project directory (that is, MyAppProject/MyApp/build.gradle, not MyAppProject/build.gradle -- confusing, I know, but the former directory is projectDir in Gradle so that's how I refer to it here). It depends on no external utilities other than Git, which is assumed to be in the path, so it should work on any OS (even though I used forward slashes in the paths, they get converted to backslashes on Windows). It could probably stand to be improved, I'm sure, as my understanding of Gradle is pretty rudimentary and my Groovy may not be very idiomatic (though that in particular is less of a concern). I have a feeling that my approach is suboptimal because it involves generatin

Categories : Android

How to create the best Android app project structure with Android Studio and Gradle?
You should look at the multiproject example for the layout attached in the doc. http://tools.android.com/tech-docs/new-build-system http://docs.google.com/viewer?a=v&pid=sites&srcid=YW5kcm9pZC5jb218dG9vbHN8Z3g6NDYzNTVjMjNmM2YwMjhhNA Essentially you want a top level settings.gradle that tie all the pieces together. Ideally they should be in one single git repo to make your life easier. However you probably can use symlink to tie them into a common build repo that contain your top level settings.gradle.

Categories : Android

How do I migrate my Android Eclipse project to using Gradle and Android Studio?
You should create a folder in you project's root and name it libs. Then copy your jar file to that folder and add dependencies { compile fileTree(dir: 'libs', include: '*.jar') } to your build.gradle file. If above won't work. You may need to try this post

Categories : Java

Failed to import Gradle project error creating new project with Android Studio
I had same issue with the latest Android Studio () today, and I finally found that configuring a https proxy for Gradle can solve the issue. I only set a http proxy at the beginning. Gradle needs to sync some files via HTTPS. Use IP address instead if hostname of proxy can't work.

Categories : Android

Android Studio Can't resolve Gradle project
I just ran into this problem when moving to a new computer. What I did was choose to import a project (using build.gradle as import file) rather than open a project. When prompted about gradle information I didn't supply a gradle home but selected to use the gradle wrapper.

Categories : Android

Add commons-io dependency to gradle project in Android Studio
you need to declare a repository where you want to resolve the commons-io library from (e.g. MavenCentral): buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android' repositories{ mavenCentral() } dependencies { compile files('libs/android-support-v4.jar') compile group: 'commons-io', name: 'commons-io', version: '2.0.1' }

Categories : Gradle

Error when importing a Gradle project into Android Studio
I finally found out why this didn't work. There are two ways to include a project from within the settings.gradle file: include ':..:source:compA-api' and include "source:compA-api" project(':source:compA-api').projectDir = new File(settingsDir, 'source/compA/api') I had used the second form and apparently Android Studio didn't like that :)

Categories : Android

Failed to import Gradle project on android studio
This problem happens when we work with android sdk studio different from what you should do is install Android Support Repository https://sites.google.com/a/android.com/tools/knownissues

Categories : Android

Android Studio import project with gradle changes iml files
The IDEA official documentation is clear about that : Share all the files under .idea directory in the project root except the workspace.xml and tasks.xml files which store user specific settings, also share all the .iml module files. Source : How to manage IntelliJ IDEA projects under Version Control Systems EDIT : But, sharing iml files seems to be wrong. Best thing is to use a similar gitignore file and to import the project in AndroidStudio for each developer.

Categories : Android

no gradle file in eclipse project Android studio
All you need is a simple build.gradle file for your ActionBarSherlock project. Here's one I've created: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.4.2' } } apply plugin: 'android-library' dependencies { compile 'com.android.support:support-v4:13.0.0' } android { buildToolsVersion "17.0" compileSdkVersion 17 sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } } }

Categories : Eclipse

Android studio add external project to build.gradle
Right click on project - Select "Open Module Settings" - Select "Modules" in left pane - Click on "+" symbol on top - Choose "Import Module". After importing Module. You need to add it as a dependency for your current project. Keep "Modules" Selected in left pane and click on your project - Now Go in dependencies tab and click on "+" symbol that is located at bottom - Choose third option "Module Dependencies" and if you have imported your project correctly, it will show you the all available module that can be added as a dependency to your current project. Hope it would help. Cheers!!

Categories : Android

Importing an eclipse project in Android studio. Error with Gradle
You have used Gradle 1.8, as your error mentions, you should use Gradle 1.6. Download it from here http://services.gradle.org/distributions-snapshots

Categories : Android

Gradle Build Failed: "occurred evaluating root project...failed to create a task or type gettype"
For anyone else having the same issue, as Greg mentioned above, switching to the official Google Android Gradle plugin should work: http://tools.android.com/tech-docs/new-build-system/user-guide There are a number of other questions that I believe were using the unofficial version in this question since it comes up high on search results when searching for the Android Gradle plugin.

Categories : Android

Android Studio Import Project - Use gradle wrapper "Disabled Option"
do the eclipse step where you export to generate the gradle build file stop importing your project for now and create a new one. close android studio. navigate on your file system to the new project. take the "gradle" folder in there and copy it in to your project. try again. :-)

Categories : Android

Create New Project Android Studio 0.2.3 - Unable to start Gradle daemon process
Well I managed to solve it after many hours of trying. First of all I use Windows 7, with 16GB ram, and it was the system path that was truncated! This left me without the proper GRADLE_HOME path. I manually downloaded the latest Gradle-1.7 build. Android studio 0.2.3 was using 1.6, but subsequently to my manual fix 0.2.5 uses Gradle-1.7. I created a System variable: GRADLE_HOME with value: D:gradle-1.7 that points to my manual Gradle install. I broke my 'real path' (before windows truncated it) into 'extended' path variables, thus shortening my actual path, and inserted the following at the end of the path: %GRADLE_HOME%/bin;%JAVA_HOME%/bin; There are many links on dealing with truncated windows path on stackoverflow. And that was all that was required to get it working. Hope I can

Categories : Gradle

Failure on build with Gradle on command line with an android studio project : Xlint error
It's a nice warning not error, to see the complete lint report you can add these lines to build.gradle: allprojects { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:deprecation" } } If you really want to get rid of those warnings: Don't use deprecated API Use @SuppressWarnings("deprecation")

Categories : Android

Change project file structure after migrating from Eclipse to Android Studio gradle structure
While migrating your project from Eclipse to Android Studio, no change have been done on project structure. The only that have changed are new .iml and .gradle files. Your java code stays in project/src/ folder, and has not been moved in project/src/main/java folder (like in a new created project from AndroidStudio). Your AndroidManifest file also stays in the project/ folder and has not been moved in project/src/main/ folder (like in a new created project from AndroidStudio). At migration, the build.gradle file is customized in order to be able to compile with the old structure is described in the gradle documentation : Configuring the Structure For a new created project in AndroidStudio, the sourceSets part of the build.gradle file : sourceSets { main.java.srcDirs = ['src/java']

Categories : Android

How do I add the library android-support-v7 in IntelliJ IDEA (Not Android Studio/Gradle)?
You just need to add "@string/abc_action_mode_done" in your appcompat/res/values/strings.Do not "set mediarouter as a dependency for appcompat library".(In my case,"@string/abc_action_mode_done" already exists in the appcompat/res/values/strings.I don't know why you miss it.) "add depenency appcompat to mediarouter" is necessary.

Categories : Android

Android Studio - Export Android library aar with pure gradle
You should try updating/upgrading your build tools and gradle through AndroidStudio. Once you do this, or if you have already done it, you should be able to modify your build file to reflect the updates: classpath 'com.android.tools.build:gradle:0.5.+' ... buildToolsVersion "18.0.1" NOTE: I am still unable to generate aar files even with this setup, although compiling is fine. At least this might get you past this hurdle.

Categories : Android

Android Studio: Android Manifest doesn't exists or has incorrect root tag
I ran into a similar problem. Looks like my .../src directory for whatever reason moved under my .../lib directory. I moved it out of the /lib directory. Now both /lib and /src are at the same level. After a couple of clean rebuilds and restarts of Android studio everything is back to normal. My emulator started up fine. You might want to check your directory structure. Compare the directory structure with a working project. You might be able to see the difference.

Categories : Android

Android: Gradle Error in Android Studio
Okay, I fixed the issue. It was quite weird. A) I had some capital letters in my res/drawables folder. Not too weird -- I can see how that would remove the first error. B) Then, however, a lot of values in my main activity file became undefined. I had to manually import 'com.myapp.R'. Now that was weird. Fortunately, everything is now working. I hope that if anyone gets the same errors as me, that this response can help them.

Categories : Android

Android: How can I open an older android project in Android Studio?
Look at this links. How do I open my existing Eclipse projects in Android Studio? http://developer.android.com/sdk/installing/migrate.html

Categories : Android

Gradle/Android: Specify 'root' as a dependency of subproject
I'm here because of searching for similar answers, although my problem is primarily the opposite. I'm finding that the integration between command-line builds (gradlew) and Android Studio 0.2.2 is full of secrets. One thing I see that stands out in your config file: this is pretty beta/alpha stuff. You have not revised your project to the latest Android Studio 0.2.0 notes. In particular, the 'com.android.tools.build:gradle:0.4' should be revised. Reference: http://tools.android.com/recent There is an open source application that has the same basic need as yours. It is a Grocery Shopping app that is provided as a sample for CouchDBLIte https://github.com/couchbaselabs/GrocerySync-Android it has to reference the existing projects. It seems to use a more explicit syntax for the dependenc

Categories : Gradle

Error: Gradle: Execution failed "Running /Applications/Android Studio.app/sdk/build-tools/android-4.2.2/aapt failed"
This is because one or more of your asset names have unsupported characters present. Replace all capitals with lowercase letters. Replace all spaces and dashes with an under-bar/underscore. AND to be safe, remove all numbers too. Another suggestion I've seen going around is to make sure your SDK is up to date, but from my own experience it has always been the names of imported assets.

Categories : Gradle

Android gradle project compiling project in a different directory tree
This google group has an answer from Android SDK developer Xavier Ducrohet. https://groups.google.com/forum/#!topic/adt-dev/bPY_Un8BsBY To quote: To depend on a gradle project that's outside of your main project's root folder you can try to do the following: include 'abs' project(':abs').projectDir = new File('/some/path/relative/or/absolute') Note that your app should do a dependency using project(':abs'), since the gradle path is :abs no matter what the on-disk path is.

Categories : Android

Android Studio - Build an Android project with Android library which depends on another Android Library
The manifest files for the library must currently have a <application /> node, even if it's empty. It's a restriction we'll remove at some point but for now, just add it.

Categories : Android

Unexpected error occurred when tried to create an Android project with phonegap-2.8.1 on mac os x
oI have get the reason of this error. I just need to restart my pc. After restarting my pc the ./create command create a new phonegap project for android with out any error. Not sure about that but i got my problem solved. Thanks

Categories : Android

Import an Android Project from Eclipse to Android Studio and I have this error message "failed to find Build Tools revision 8.0.0"
Your build.gradle is trying to use Android SDK tools 8 which isn't installed on your machine. If you look at your build.gradle file you probably have this line buildToolsVersion "8". You want your build.gradle file to point to the Android SDK tools that you currently have installed (preferably the latest). Just open the Android SDK manager and see which tools you have installed and change the buildToolsVersion "8" to the right version.

Categories : Android

Android copy existing project with new name in Android Studio
The steps in the link you specified should also work for Android Studio. Just make a copy (using a file manager) of the entire module folder and give it a new name. Now open it up and use Refactor -> Rename (right click on the item you want to rename) to rename your module and package. See this for details about refactoring in IntelliJ/Android Studio.

Categories : Android

Android Studio: how to import Android library project
Go back to Project Structure window where you added the new module. Click on your main module, go to Dependencies tab, click the plus icon and select Module Dependency.

Categories : Android

Gradle: Project "x" not found in root project "myProject"
You need to migrate your Eclipse project in order to have a build file (build.gradle) Migrating from Eclipse : Update your Eclipse ADT Plugin (you must have version 22.0 or higher). In Eclipse, select File > Export. In the window that appears, open Android and select Generate Gradle build files. Select the project you want to export for Android Studio and click Finish. Your selected project remains in the same location but now contains a build.gradle file and is ready for Android Studio. Then, Android Studio will be able to build your project using this build.gradle file.

Categories : Android

Android Studio Gradle programming
You missed the sample comments. versionName getVersionName.output() should work. EDIT: Change your task code to the following. task getVersionName(type:Exec) { exec { commandLine '../scripts/version-name.sh' } ... } I am also new to gradle, it seems they have some bugs or the documentation is lacking. Since the code you had tried out is exactly from the sample, available in the document.

Categories : Gradle

How to update gradle in android studio
You have to modify the dependency in gradle.build See this answer Source

Categories : Gradle

Android Studio Gradle First Steps
How the buildtypes depend on flavors...do they just multiply every flavor to every buildtype? Yes, Gradle will generate every combination of build types and product flavors. As per the Gradle Plugin User Guide, each build type and product flavor combination is referred to as a build variant. Is it ok to set a sourceSet (if it is possible to set more sourceSets), like this in a flavor? Sure! Product Flavors (and Build Variants) also automatically include their own sourcesets from src/myFlavorName, as per the Sourcesets and Dependencies documentation.

Categories : Android

How to set -source 1.7 in Android Studio and Gradle
At current, Android doesn't support Java 7, only Java 6. New features in Java 7 such as the diamond syntax are therefore not currently supported. Finding sources to support this isn't easy, but I could find that the Dalvic engine is built upon a subset of Apache Harmony which only ever supported Java up to version 6. And if you check the system requirements for developing Android apps it also states that at least JDK 6 is needed (though this of course isn't real proof, just an indication). And this says pretty much the same as I have. If I find anything more substancial, I'll add it. Edit: It seems Java 7 support has been added since I originally wrote this answer; check the answer by Sergii Pechenizkyi.

Categories : Java

Gradle Error for Android Studio
It warns you that android plug-in task validateDebugSigning cannot access the debug key. Check your accessibility to the debug.keystore. On linux or OS X, the default location is ~/.android. On windows, it's in C:Documents and Settings.android or C:Users.android.

Categories : Android

Android Studio / Gradle Build questions
yes yes hmm that's quite a lot. I think there are going to be issues. For instance right now Gradle doesn't let us parallelise the compilation of the variants, so it's going to take forever to build. Also, you might run out of RAM when setting up the internal model that represent all the variants and their associated properties and tasks. I guess you should just try it and see. Using simple groovy code you should be able to dynamically create 2000 flavors in an empty projects and then see if you can compile without problem.

Categories : Android

Android Studio 0.2.7 build exception with Gradle
Not being able to run the application may be because you didn't configure jdk/jre properly. Try making system variable PATH point to your ...Javajdk[version]in and CLASSPATH to ...Javajdk[version]lib. Also, in android studio go to file>other settings> default project structure > sdks and navigate to your jdk install folder.

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.