android-gradle

How to specify source and target compatibility in Java module?

霸气de小男生 提交于 2019-11-29 10:05:36
I have a Gradle project consisting of an Android module (the com.android.library plugin is applied in the build.gradle file) and a Java module (the java plugin is applied in the build.gradle file). Within the build.gradle file of the Java module I was previously specifying the source and target compatibility as follows: apply plugin: 'java' compileJava { sourceCompatibility = 1.7 targetCompatibility = 1.7 } I've just updated the project's "Android Plugin for Gradle" and "Gradle Wrapper" versions to the latest releases (2.2.3 and 3.2.1 respectively) and I'm now seeing warnings in the Java

Error:Execution failed for task ':app:mergeDebugResources'. > Some file crunching failed, see logs for details build gradle issues

大憨熊 提交于 2019-11-29 09:20:28
currently I am using Android Studio 2.1 when I run my App it shows me some error in Message Gradle Build saying the following Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:prepareDebugUnitTestDependencies, :app:mockableAndroidJar, :app:generateDebugAndroidTestSources, :app:assembleDebug] :app:clean :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72221Library :app:prepareComAndroidSupportDesign2221Library :app:prepareComAndroidSupportSupportV42221Library :app

How to resolve Duplicate files copied in APK META-INF/rxjava.properties

风格不统一 提交于 2019-11-29 09:06:50
I am using rxjava and rxvolley on my android aplication. When I try to run it I get this error Execution failed for task ':testapp:transformResourcesWithMergeJavaResForDebug'. > com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/rxjava.properties File1: C:\Users\Daniel\.gradle\caches\modules-2\files-2.1\io.reactivex\rxjava\1.1.0\748f0546d5c3c27f1aef07270ffea0c45f0c42a4\rxjava-1.1.0.jar File2: C:\Users\Daniel\.gradle\caches\modules-2\files-2.1\io.reactivex.rxjava2\rxjava\2.0.3

Gradle build: resource android:style/TextAppearance.Material not found

我的未来我决定 提交于 2019-11-29 08:00:31
I just installed AndroidStudio and imported an old Eclipse ADT project (API level 18). However, when trying to build this project in AndroidStudio, I get the following errors: resource android:style/TextAppearance.Material not found. resource android:style/TextAppearance.Material.Body1 not found. resource android:style/TextAppearance.Material.Body2 not found. resource android:style/TextAppearance.Material.Button not found. resource android:style/TextAppearance.Material.Caption not found. resource android:style/TextAppearance.Material.Display1 not found. resource android:style/TextAppearance

Reset default gradle and plugin for android studio to be up to date when creating new projects?

和自甴很熟 提交于 2019-11-29 07:58:24
Is there a way to reset the default gradle and plugin, without resetting all my settings, so I don't keep having these errors when creating new projects? Error: Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to So in the top level build.gradle I update to: dependencies { classpath 'com.android.tools.build:gradle:2.0.0-alpha6' } And then change the gradle to 2.10 as per requirements here. 2.0.0-alpha5 (2016/1/14) // hence alpha6 Needs gradle 2.10 to work Android Studio Template Files located on below path: {android_studio

Execution failed for task 'app:prepareDebugAndroidTestDependencies'

寵の児 提交于 2019-11-29 07:58:10
I'm trying to build UI tests for my Android application in Android Studio. The problem is that I can't run them. I get the message: Execution failed for task 'app:prepareDebugAndroidTestDependencies' which I couldn't find what it's about. When I run my application, it starts perfectly, but when i try to run tests it shows the mentioned message. My build.gradle is lsited below: apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.0" defaultConfig { applicationId "ba.etf.pkks.eldaralmin.libraryapp" minSdkVersion 15 targetSdkVersion 22 versionCode 1

Jacoco converting coverage.ec to reports without coverage.em

可紊 提交于 2019-11-29 07:49:41
I was able to get the code coverage report by following the steps below, Enable coverage on the build type you want (e.g. debug) buildTypes { debug { testCoverageEnabled true } } Apply Jacoco plugin and set version apply plugin: 'jacoco' jacoco { version "0.7.1.201405082137" } Run ./gradlew createDebugCoverageReport All the tests in connectedAndroidTest are run and coverage report is generated based on them. I can find the coverage reports in app/build/outputs/reports/coverage/{buildType}/index.html and a coverage.ec file in app/build/outputs/code-coverage/connected/coverage.ec But no jacoco

Use different resources (graphics and strings) for different application flavors using gradle

╄→尐↘猪︶ㄣ 提交于 2019-11-29 07:38:48
There are already several questions on this ( different icons which didn't work and different names which did work ), but the answers to those aren't yet quite enough to get my app working the way I need. I'm brand-new to Gradle, just started converting to it yesterday, and there are just a couple things I haven't been able to figure out. I have 3+ apps working off the same codebase, each using different app launcher icons and names, URLs, but right now I can't get the different icons and app names to work for each app. Before I added the sourceSets, my appName and other custom strings worked,

How to read a file from src/instrumentTest/resources directory in Android?

和自甴很熟 提交于 2019-11-29 07:38:26
I have an Android application using the new standard gradle layout: src/main/java src/main/resources src/instrumentTest/java src/instrumentTest/resources I have a unit test in src/instrumentTest/java/com/example/MyUnitTest.java that reads a file located in src/instrumentTest/resources/testfile.json First question: Is it the right place for placing the testing files? Second question: How can I read that file in a String? I have tried these two ways for reading the file in the unit test with no success (it cannot find the file): String myJson = new Scanner(new File("testfile.json"),"UTF-8")

Java.util.zip.ZipException: duplicate entry: com/google/common/base/FinalizableReference.class

天大地大妈咪最大 提交于 2019-11-29 07:35:23
Why am getting this error it will not occurred when I sync the Gradle but when I'm running the project I am getting this error . Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/common/base/FinalizableReference.class I don't know which dependency cause this error, My dependencies are . dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android