w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to set up gradle and android studio to do release build?
in the latest version of android studio, you can just do: ./gradlew assembleRelease or aR for short. This will produce an unsigned release apk. Building a signed apk can be done similarly or you can use Build -> Generate Signed Apk in Android Studio. See the docs here Here is my build.gradle for reference: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android' dependencies { compile fileTree(dir: 'libs', include: '*.jar') } android { compileSdkVersion 17 buildToolsVersion "17.0.0" sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['

Categories : Android

How to create a release signed apk file using Gradle?
I managed to solve it adding this code, and building with gradle build: android { ... signingConfigs { release { storeFile file("release.keystore") storePassword "******" keyAlias "******" keyPassword "******" } } buildTypes { release { signingConfig signingConfigs.release } } } This generates a signed release apk file.

Categories : Android

Any way configure to configure visual studio mvc build views release mode
Are you specifically setting something to compile the views like the Razor Generator? (http://razorgenerator.codeplex.com/) If not views in MVC are not compiled.

Categories : Asp Net Mvc

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 replace a string for a buildvariant with gradle in android studio?
I solved the problem on my own, so here is the solution "step by step" - perhaps it will help some other newbies to gradle :) Copy Task in General: copy{ from("pathToMyFolder"){ include "my.file" } // you have to use a new path for youre modified file into("pathToFolderWhereToCopyMyNewFile") } Replace a line in General: filter{ String line -> line.replaceAll("<complete line of regular expression>", "<complete line of modified expression>") } I think the biggest problem was to get the right paths, because I had to make this dynamically (this link was very helpful for me). I solved my problem by replacing the special lines in the manifest and not in the String-file. The following example shows how t

Categories : Android

APKs with identical release keystores
As far as I am aware it doesn't matter if more than one app uses the same keystore, however, if someone manages to find it, they can then use it to deploy dodgey versions of your app onto the market. You can't howver, have two versions of the same app uploaded to the play store unless you change the package name within the AndroidManifest file.

Categories : Android

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

Ant Build for Android proj:: how to create the myproject-release.apk (signed) to a folder other than bin?
Add a custom Ant task that moves the APK file after your production build. You would put that Ant task towards the bottom of build.xml, just inside the trailing </project> close tag. For example, here is a jar task that creates a JAR file: <target name="jar" depends="debug"> <jar destfile="bin/CWAC-Layouts.jar" basedir="bin/classes" /> </target> In your case, you would create a task that uses <move>. You will also want to modify the <!-- version-tag: 1 --> comment, just above where you are placing your Ant task, to be <!-- version-tag: custom -->. This will prevent Android's tools from clobbering your build.xml changes if they elect to modify build.xml themselves. Then, run that Ant task.

Categories : Android

Trying to set up admob in Android Studio
I think you're declaring the dependency in the wrong place. Try with this: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.7.+' } } apply plugin: 'android' dependencies { compile fileTree(dir: 'libs', include: '*.jar') } android { compileSdkVersion 17 buildToolsVersion "17" defaultConfig { minSdkVersion 11 targetSdkVersion 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'] } instrumentTe

Categories : Android

Why is AdMob integration in my app using Android Studio not working?
Check your target api level and minimum api level. i had similar issue before and i solved it like this: target api level = highest available minimum api level = 9 I dont know much about Android studio but you can do it from manifest.xml i hope it helps.

Categories : Android

Android: automatically choose debug/release Maps v2 api key?
I solved this issue using this steps: In Google Developer API Console Click on Create New Android key... In cmd.exe/Terminal: keytool -list -v -keystore mystore.keystore Password: android Now enter SHA1 key;package name for debug and press enter Enter SHA1 key;package name for release Click on Create Now use this API key your project <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="@string/common_map_api_key"/>

Categories : Android

Android gradle build: running assembleDebug makes release tasks of project dependencies being called
Android library modules publishes only "release" build type. They don't have "debug" build type. Even your application module build the debug version, it will use the release version of the library. You can enable "debug" build type of the library dependency using the following in your module's build.gradle file: android { publishNonDefault true ... } Then when you are using that dependency in the other module, you should use like this: dependencies { releaseCompile project(path: ':moduleY', configuration: 'release') debugCompile project(path: ':moduleY', configuration: 'debug') } I am using the same trick in my application. I have a shared module and I use debug version of the module. Find details here: https://github.com/pomopomo/WearPomodoro/blob/develop/mobile/build.g

Categories : Android

Google map not showing on android (signed apk) with Google V2 release key
Google Maps Will not work with the latest change in their policies which limits the usage of google map libraries directly. To solve this either you have to include entire google maps as a third party plug in or you can display the google map in an webview and pass locations through a javascript html function. for ex:-- <script> function initialize() { document.getElementById('dummyDIV').innerHTML = '<div id="googleMap" style="width:'+screen.width+'px;height:'+screen.height+'px;"></div>'; var sURL1 = window.document.URL; var sURL2 =sURL1.split("%20"); var sURL= sURL2[0]; for (j=1;j<sURL2.length;j++){ sURL = sURL+' '+sURL2[j]; } var mapProp = { center:new google.maps.LatLng(19.155721,72.856025), zoom:10, disableDefaultUI:true, zoomControl:true,

Categories : Android

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

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

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

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

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

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

Android Studio: run app with release keystore to display GoogleMaps v2
I believe I read that the latest version of maps now have to have contact with the Google Play server (ie: must run on device itself now and not in an emulator). I'll be facing the same issue soon. https://developers.google.com/maps/documentation/android/start I think this is what you're asking but I may have misread the question?

Categories : Android

Creating release key for Facebook SDK 3.0 in Android
Check that the signing certificates for the APK and registered on Facebook developer account match up. It seems like they don't. See Facebook #5. Add your release key hash to the list.

Categories : Android

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

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 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 replace strings resources with Android Gradle
In your "src" folder, create "flavor1" and "flavor2" folders with the same hierarchy as your "main" folder. If you have strings.xml in your main/res/values, you can do it in flavor1/res/values as well and have the replacement values in there. It may show errors in the IDE but it should still build and run.

Categories : Android

Android Studio Gradle Build Flavors
With this build script you are using build types AND flavors. For changing the xml file you only need the flavors. Try to delete buildTypes and use the productFlavor block as child of android. The changing of the res folder of the pro flavor should go into the sourceSets Block right after all the changes of the main sourceSet

Categories : Android

Gradle error on Android Studio startup
In the error message, the path appears: 'P:ProjekteVertretungsplanProjectlibrariesactionbarsherlock:Vertretungsplanlibsandroid-support-v4.jar' It looks like you're on Windows. The semicolon before Vertretungsplan is not a legal filesystem character. This appears in your script as compile files(':Vertretungsplan/libs/android-support-v4.jar') Try changing this to compile files('Vertretungsplan/libs/android-support-v4.jar')

Categories : Gradle

Android studio Gradle build speed up
The dev are working on it. Like I posted in this answer the fastest solution right now is to use gradle from the command line and you should switch to binary libs for all modules you do not develop. On g+ there is a discussion with the developers about it.

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

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

Build issues with Gradle Android studio 0.2.1
I finally managed to bring Android Studio back into working state. I gave up on the 0.2.1 update and reverted to 0.2.0, which we all know worked just fine. Here's how I did it: I uninstalled Android Studio ( Add/Remove Programs ), deleted the contents of Androidandroid-studio ( except for sdk folder and SDK Manger.exe ) and then downloaded and installed the more stable version from the bundle right here: http://developer.android.com/sdk/installing/studio.html#Updating After that, you should be able to reopen the projects you were working on, without encountering any other errors. Good luck!

Categories : Android

Android Studio and Gradle - build fails
I found the problem: I removed that line from the sample gradle file. compile files('libs/android-support-v4.jar') However, I have no idea why this does not work (if I have 2 or 3 external libraries that all depend on the support library, how are we supposed to do, without touching their gradle files?

Categories : Android

Android Studio gradle and libraries import
I don't know how to solve your problem, but when I faced problem of third party library use in Gradle build, I solved by following way. Following is my structure of project. GsonDemoProject    GsonDemo       build       libs           android-support-v4.jar           gson.jar       src           main           build.gradle       build.gradle       settings.gradle I edited my build.gradle file which resides in src directory.

Categories : Android

Android Studio w/gradle: Package r does not exist
samples (with multi module project and multi lib projects) zipped. http://tools.android.com/tech-docs/new-build-system/ scroll to the bottom. regarding Could not find com.android.tools.build:gradle:0.5. this jar is not in maven central, it comes with Android Studio 0.2.+ Usually happens if you upgrade Android Studio from pre 0.2 which doesn't have internal m2 repo. Install fresh Android studio and it should work. Same story with support library.

Categories : Java

Android Studio gradle failure on debug
Try to run "gradlew compileDebug" from the command line to fix this problems. See this answer for more information. Also make sure to update your gradle plugin to the latest version. (0.4.3 since yesterday) Use com.android.tools.build:gradle:0.4.+ in your gradle.build file and you'll always get the latest gradle android plugin.

Categories : Java

android studio "Use gradle wrapper" grayed out
1) Create a new simple project with Android Studio. 2) Find the gradle folder in the new project. 3) Use the export option in eclipse to create the build.gradle script. (Requires at least adt version 22.0) 4) Copy the gradle folder into the project you want to export to Android Studio. 5) Now try to import this project, u shall be able to select the wrapper check box. This may resolve the problem you asked for, you can also set the Gradle home path and use the other option just fine. Hope this helps!

Categories : Android

android studio gradle server configuration
Start with this link: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Types Among other things, this section means that a module in an Android Studio project can use separate "debug" and "release" directories of source-code/resources/etc. So, for example, in a project created by Android Studio (not imported from Eclipse), you can use these files without any additional configuration in "build.gradle": <Module>/src/main/res/values/strings.xml (created by the IDE by default) <Module>/src/debug/res/values/strings.xml (created manually by you) <Module>/src/release/res/values/strings.xml (created manually by you) In the debug directory's strings.xml file, you can define a new string resource such as: <string name="server_uri">http://www.myt

Categories : Android

Android Studio with gradle and Google Maps v2
I have tried and failed many a tutorial on this, but finally find a simple solution that seem to work. I just installed Android Studio 0.2.3 on my mac, and these are the steps that made me view a maps fragment on a fresh hello world project template: 1) Click the SDK manager button in the toolbar in Android Studio. 2) Under 'Extras' locate 'Google play services' and download it. 3) in your build.gradle file in your src directory, add this line to dependencies: compile 'com.google.android.gms:play-services:3.1.36' 4) order and install your API-key following this tutorial: https://developers.google.com/maps/documentation/android/start#the_google_maps_api_key 5) add the fragment to your layout xml: <fragment xmlns:android="http://schemas.android.com/apk/res/android" andr

Categories : Android



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