android-gradle

Android studio - App with library project fails to build

风格不统一 提交于 2019-11-27 19:20:34
I'm having massive trouble trying to get my app project to build. I have the main app module and a library project module as shown below: This is the gradle.build for each of the modules: Main App: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.6.+' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion '19.0.0' defaultConfig { minSdkVersion 14 targetSdkVersion 19 } buildTypes { release { runProguard true proguardFile getDefaultProguardFile('proguard-android-optimize.txt') } }

Android using Gradle Build flavors in the code like an if case

那年仲夏 提交于 2019-11-27 19:14:46
I'm trying to work with build flavors. In my build.gradle I've defined 2 flavors, a normal flavor and an admin flavor. Basicly the admin flavor has an extra button on the main activity. I understand that I can define different packages/classes for different flavours. But is there a way to make a sort of if case to add/remove a piece of code depending on the flavor? Basicly I would need two versions of an Activity. But I don't want two entire different versions of the activity and maintain them. So in my activity I would like to do => gradle check if flavour is 'admin' => if yes add this code

Android studio where is gradle.properties file?

瘦欲@ 提交于 2019-11-27 18:39:05
I'm trying to generate a signed apk but I always get the same error. To run dex in process, the Gradle daemon needs a larger heap. It currently has approximately 910 MB. For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB. To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties. I can´t file that file but I tried modify gradle-wrapper.properties but I still get the same error. This is my gradle-wrapper.properties file #Thu May 05 20:51:44 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE

Can't find import module option in project structure (Android Studio 0.3.4 - 0.5.2)

こ雲淡風輕ζ 提交于 2019-11-27 18:26:51
I'm getting really confused and frustrated because I just can't understand how to import my android library project as dependency for my application project. I tried to find online and most of the answers suggested to go to project structure of my application and click on '+' and then click on 'import module' But Android Studio 0.3.4 - 0.5.2 doesn't show any options and when I click on '+', it just shows the windows for a new module. Am I doing something wrong or what ? Help!!! You'll run into this when working with Gradle-based projects, as this one is; even in 0.3.2, this Import project

Gradle build failing after update to 3.0

烂漫一生 提交于 2019-11-27 18:04:47
I've recently updated the gradle version of my project from 2.14.1 to 3.0. Since then the gradle build is failing every time with this error: Error:Cause: org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection Possible causes for this unexpected error include: Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network) The state of a Gradle build process (daemon) may be corrupt.

Android Studio DexIndexOverflowException: method ID not in

。_饼干妹妹 提交于 2019-11-27 17:40:45
I use Android Studio to develop an application and I face this error which I have no idea how to solve. com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff] :app:lintVitalRelease :app:prePackageMarkerForRelease :app:transformClassesWithDexForRelease FAILED Error:Execution failed for task ':app:transformClassesWithDexForRelease'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536 Information:BUILD FAILED

Gradle: How to publish a Android library to local repository

岁酱吖の 提交于 2019-11-27 17:37:10
I have a library and a Android app using Gradle and Android Studio. I can include the library directly in the project as following compile project(':library') Because I don't want to mesh up with library source code, I want to publish the library into local repository so that I can use as compile 'com.mygroup:library:1.0' Any advise? Bao Le I just found a solution. In the build.gradle of the library project, add this apply plugin: 'maven' group = 'com.mygroup' version = '1.0' uploadArchives { repositories { mavenDeployer { repository(url: "file://[your local maven path here]") // or repository

Android Studio Gradle: Error:Execution failed for task ':app:processDebugGoogleServices'. > No matching client found for package

感情迁移 提交于 2019-11-27 17:28:36
I am trying to upgrade my google play services dependencies to 8.4.0 by following the example Google gives here , but I am getting the following error ('com.example.exampleapp' is a replacement for my app package name): Error:Execution failed for task ':app:processDebugGoogleServices'. > No matching client found for package name 'com.example.exampleapp' Project build.gradle: buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-alpha3' classpath 'com.google.gms:google-services:2.0.0-alpha3' // NOTE: Do not place your application dependencies

How to set up gradle and android studio to do release build?

点点圈 提交于 2019-11-27 17:16:48
I want to build android app and start signing it. For that I need to have Release version of apk. Google documentation suggests only Eclipse and ant ways to have release builds: http://developer.android.com/tools/publishing/app-signing.html#releasecompile However I cannot find how to force gradle build release version of apk. build.gradle does not give any hints either. gradlew tasks suggests, that there is no install Release configuration, but uninstall release exists: Install tasks ------------- installDebug - Installs the Debug build installTest - Installs the Test build for the Debug build

Error running android: Gradle project sync failed. Please fix your project and try again

你说的曾经没有我的故事 提交于 2019-11-27 17:11:36
Android Studio (1.2 RC0) keeps telling me Error running android: Gradle project sync failed. Please fix your project and try again. How can I find out what the problem is? Unfortunately the solutions from this SO thread did not help. Goto File -> Invalidate caches / Restart Shutdown Android Studio Rename/remove .gradle folder in the user home directory Restart Android Studio (It will download gradle metadata and data) Gradle build succeed Rebuild project. Done. tsigehiwet kahsayu Solution is Connect your computer to the internet Click Sync project with Gradle files On toolbar It will