Tag: Android Gradle

在Android上使用不同的密钥进行Gradle签名

我有我的Android应用程序的许多口味, 我想除了一个都使用相同的密钥 。 有一个需要使用不同的密钥。 我如何重写signingConfig适用于应用程序的味道(但在相同的构buildtypes,如“释放”)的signingConfig ? 我希望所有版本默认使用主版本configuration。 我只想覆盖1味 我希望能够用一个gradlew assembleRelease命令来运行所有的发行版本 最后一点非常重要,因为我现在有超过120种不同的口味,而且越来越多。 为了定制每一个单独的风味是很多额外的工作。 相关的post我试过了: 使用单一构buildtypes的不同键生成多个构build 这需要对每种风味进行configuration 它似乎并不使用我的自定义signingConfig无论如何 用gradle签署产品口味 接受的解决scheme不起作用(对我来说) 根据评论,这是可能的通过将buildTypes内的productFlavors但我不明白如何做到这一点。 在Gradle Product Flavors上debugging签名configuration 正如在博客文章中解释的那样: 使用Gradle构buildAndroid应用程序的多个版本 它实际上不起作用,它完美的作品 但对于119种口味来说,这并不好 总的来说,每个解决scheme似乎仍然使用默认的发布configuration,而不是我的自定义configuration。 我的build.gradle重要部分是这样的: signingConfigs { releaseConfig { storeFile file('key') storePassword "pass" keyAlias "alias" keyPassword "pass" } custom { storeFile file('custom_key') storePassword "pass" keyAlias "alias" keyPassword "pass" } } productFlavors { […]

NoSuchFieldError:在Play Services 6.5中使用MapFragment时没有静态字段的MapAttrstypes

也许我错过了一些东西,但是我无法在Play Services 6.5中使用新的仅支持Google Maps的依赖关系 我得到以下例外: java.lang.NoSuchFieldError: No static field MapAttrs of type [I in class Lcom/google/android/gms/R$styleable; or its superclasses (declaration of 'com.google.android.gms.R$styleable' appears in /data/app/com.kaching.merchant.dev1-1/base.apk) at com.google.android.gms.maps.GoogleMapOptions .createFromAttributes(Unknown Source) at com.google.android.gms.maps.SupportMapFragment .onInflate(Unknown Source) performance: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="my-awesome-key"/> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> Gradle文件: compile 'com.google.android.gms:play-services-maps:6.5.+' compile 'com.android.support:support-v4:21.0.2' 布局: <fragment android:id="@+id/map" android:name="com.google.android.gms.maps.MapFragment" android:layout_width="match_parent" android:layout_height="match_parent"/> 这是打破了还是我做错了什么? […]

Android Wear项目Gradle Sync失败

我在Android Studio 0.8中创build了一个新项目,以便将Android Wear集成到我的一个应用程序中。 我创build了一个新项目,并包含Wearforms因素,但是当我尝试同步时,我得到: 错误:找不到与com.google.android.support:wearable:+匹配的任何版本。 必需:win_control:磨损:未指定 编辑:我玩Gradle了一下,现在我得到这些错误: 错误:无法find:com.google.android.gms:play-services-wearable:+在“项目结构”对话框中打开 打开文件 错误:无法find:com.google.android.support:wearable:+在“项目结构”对话框中打开 打开文件

使用Google Services 3.0.0和build.gradle中的Maps API密钥丢失api_key /当前密钥

我的问题与使用Google Services 3.0.0丢失api_key / current密钥非常相似,但是具有更高的复杂性。 我今天上午更新了我的应用程序com.google.gms:google-services:3.0.0和所有play-services 9.0.0依赖关系 compile 'com.google.android.gms:play-services-analytics:9.0.0' compile 'com.google.android.gms:play-services-ads:9.0.0' compile 'com.google.android.gms:play-services-identity:9.0.0' compile 'com.google.android.gms:play-services-gcm:9.0.0' 现在我得到臭名昭着的错误 错误:任务':hotelsclick:processDebugGoogleServices'的执行失败。 >缺lessapi_key / current_key对象 这似乎是由于google-services.json文件中缺lessAPI密钥(所以我被告知)。 我从https://developers.google.com/cloud-messaging/android/client#get-config获得了新的API密钥,并在其中find以下字段。 "api_key": [], 我想我应该把我的Google Maps API键放在那里,但是这里出现了我遇到的双重问题: 1-如果我试图把钥匙放在那个领域里面,那不行。 我尝试了两个 "api_key": [{ "current_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-AE" }], 和 "api_key": ["XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-AE"], 错误保持不变。 我一直在使用gradle来使用dynamicbuild筑。 我把下面的模块build.gradle: buildTypes { release { minifyEnabled true shrinkResources true debuggable false resValue "string", "google_maps_api_key", "ABCDEFGHILMNO… my […]

Dex错误在Android Studio 3.0 Beta4上

Error:java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex Error:java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex Error:com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex Error:com.android.dex.DexException: Multiple dex files define Lcom/google/zxing/integration/android/IntentResult;

Gradle构buildnull控制台对象

我试图让我的gradle构build提示在控制台input密码使用堆栈溢出的例子 当我有一个表述如: def password = System.console().readLine("Enter keystore password ") 当我跑我得到错误 Cannot invoke method readLine() on null object 看来控制台是null出来。 我读过这个需要java 6,如果我去命令提示符并键入java -version我正在运行Java(TM)SE运行时环境(内部版本1.6.0_27-b07)。 这个问题正在Gradle的Github库中进行跟踪: 无法将System.console()与Gradle守护程序一起使用 。

如何使用Android gradle插件0.10.0或更高版本获得jacoco覆盖率报告?

我正在尝试使用Gradle Android插件0.10.2来获得testing覆盖率报告。 但是运行一些testing后我仍然无法获得覆盖报告。 (connectedAndroidTest)。 我的主要模块的build.gradle是: apply plugin: 'android' android { compileSdkVersion 19 buildToolsVersion "19.0.3" defaultConfig { minSdkVersion 8 targetSdkVersion 19 versionCode 1 versionName "1.0" } buildTypes { debug { testCoverageEnabled true } release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:19.+' } 而项目构buildgradle的buildscript部分是: buildscript { […]

Gradle版本1.8是必需的。 当前版本是1.6

有一个新的Android Studio更新: https : //sites.google.com/a/android.com/tools/recent/androidstudio030released 该链接说: 通过改变Gradle 1.8和Android Gradle插件版本0.6,可以提高性能 所以我改变了我的依赖像这样: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.6.+' } 但我不知道在哪里可以将Gradle 1.6更改为1.8 … 而当我编译的应用程序,我有这个错误: Gradle:评估项目时发生问题。 Gradle版本1.8是必需的。 当前版本是1.6 我可以在哪里更改版本? 提前致谢 :)

Jacoco和unit testing使用android-gradle-plugin代码覆盖> = 1.1

我最近开始在我的一个项目中集成android-gradle-plugin 1.1.0。 该项目使用robolectric 2.4来运行unit testing。 这是一个具有非常复杂的依赖关系的多模块项目(一些模块依赖于其他模块)。 类似的东西: –> application-module (dependsOn: module1, module2, module-core) –> module1 (dependsOn: module-core) –> module2 (dependsOn: module-core) –> module-core (dependsOn: module3, module4) –> module3 (library dependencies) –> module4 (library dependencies) 要获得更清晰的图片,请参阅jacoco示例项目。 我试图整合JaCoCo为unit testing生成报告,但在我看来,它只运行基本上是仪器testing的androidTests 。 在Google之后,我遇到了GitHub和其他文章中的一些项目,但是他们主要关注的是以前版本的android-gradle-plugin或者正在使用其他第三方插件,比如android-unit-test 。 可能是我失去了我的能力谷歌。 但有人可以指向我的方向,我可以find一些关于在Android的gradle插件的新东西的文件,以及如何运行的unit testingjacoco任务? UPDATE 通过nenick的例子的脚本: apply plugin: "jacoco" configurations { jacocoReport } task jacocoReport(dependsOn: 'testDebug') […]

Android Studio更新之后:未findGradle DSL方法:'runProguard()'

我刚刚更新了我的Android Studio,现在我的项目将不再生成。 我得到以下错误: Error:(16, 0) Gradle DSL method not found: 'runProguard()' Possible causes:<ul><li>The project 'App' may be using a version of Gradle that does not contain the method. <a href="openGradleSettings">Gradle settings</a></li><li>The build file may be missing a Gradle plugin. <a href="apply.gradle.plugin">Apply Gradle plugin</a></li> 我没有改变任何东西,更新之前一切正常。 这是我的build.gradle文件: apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion "20.0.0" defaultConfig […]