android-gradle

How to change app name per Gradle build type

江枫思渺然 提交于 2019-11-27 11:16:06
I am trying to figure out a way to be able to change my application's app name per build type in gradle. For instance, I would like the debug version to have <APP_NAME>-debug and the qa version to have <APP-NAME>-QA . I am familiar with: debug { applicationIdSuffix '.debug' versionNameSuffix '-DEBUG' } However, I can't seem to find a gradle command to apply the change of the app when in the launcher. If by "app name", you mean android:label on <application> , the simplest solution is to have that point at a string resource (e.g., android:label="@string/app_name" ), then have a different

Publish an Android library to Maven with aar and source jar

老子叫甜甜 提交于 2019-11-27 11:06:50
Can somebody give me a hint on how to use the maven-publish gradle plugin to publish a com.android.library project/module with aar and source jar? I am able to do this with the old maven plugin - but I would like to use the new maven-publish plugin. Here's a sample using the new maven-publish plugin. apply plugin: 'maven-publish' task sourceJar(type: Jar) { from android.sourceSets.main.java.srcDirs classifier "sources" } publishing { publications { bar(MavenPublication) { groupId 'com.foo' artifactId 'bar' version '0.1' artifact(sourceJar) artifact("$buildDir/outputs/aar/bar-release.aar") } }

how append date build to versionNameSuffix on gradle

邮差的信 提交于 2019-11-27 11:05:28
I am using Android Studio and I need to append a suffix to the versionNameSuffix on my Android build.gradle file. I have three different buildTypes and I only need to append the datetime to my "beta" release, my actual file is: defaultConfig { versionCode 14 versionName "0.7.5" minSdkVersion 9 targetSdkVersion 18 } buildTypes { beta { packageNameSuffix ".beta" versionNameSuffix "-beta" signingConfig signingConfigs.debug } .... } for testing and automatic deploy, I need to get a final versionName like: 0.7.5-beta-build20131004 , 0.7.5-beta-build1380855996 or something like that. Any ideas?

Android Studio two flavors with different manifest files

这一生的挚爱 提交于 2019-11-27 10:47:24
I'm having issues with defining two different manifest files for my flavors in Android Studio. This is my current project structure: The AndroidManifest.xml in the free flavor looks like this: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="se.example.package"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> </manifest> The AndroidManifest.xml in the main flavor has

Missing api_key/current key with Google Services 3.0.0

我是研究僧i 提交于 2019-11-27 10:37:40
Since I upgraded the project with the latest version of google services and libraries (9.0.0), I have this strange issue : Grade console : :app:processDebugGoogleServices Parsing json file: /Users/cyrilmorales/Documents/Projects/mobilemeans-punainenristi/app/google-services.json :app:processDebugGoogleServices FAILED Error:Execution failed for task ':app:processDebugGoogleServices'. > Missing api_key/current_key object Information:BUILD FAILED build.gradle (root) : dependencies { classpath 'com.android.tools.build:gradle:2.2.0-alpha1' classpath 'com.google.gms:google-services:3.0.0' } build

API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()

橙三吉。 提交于 2019-11-27 10:01:55
Using Android Studio 3.3 Canary 11 with the gradle plugin version 3.3.0-alpha11 . It throws the following error when trying to sync gradle WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'. It will be removed at the end of 2019. For more information, see https://d.android.com/r/tools/task-configuration- avoidance Affected Modules: app Clicking on the error leads me to this line in the gradle file applicationVariants.all { variant -> variant.outputs.all { outputFileName = "${variant.name}-${variant.versionName

AAPT: error: resource android:attr/fontVariationSettings not found and resource android:attr/ttcIndex not found

China☆狼群 提交于 2019-11-27 09:48:21
I m currently working on an android project, so when I upgrade the project from android targetSdkVersion 21 to 27, the project won't work. so if there's anyone here who can help me to fix that problem. I m using mac os 10.12. this app/build.gradle : apply plugin: 'com.android.application' apply plugin: 'org.greenrobot.greendao' android { compileSdkVersion 27 buildToolsVersion "27.0.3" defaultConfig { applicationId "ma.oujda.ifdose" minSdkVersion 21 targetSdkVersion 27 versionCode 1 versionName "1.1" vectorDrawables.useSupportLibrary = true testInstrumentationRunner "android.support.test.runner

Error:Execution failed for task ':app:dexDebug' error in my project while I added new dependency

淺唱寂寞╮ 提交于 2019-11-27 09:48:02
I didn't added any libraries / jars in my project( in libs ) only this dependencies. My build.gradle file. android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { applicationId "com.android.example23" minSdkVersion 14 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support

After update android studio could not create parent directory for lock file

此生再无相见时 提交于 2019-11-27 09:20:36
Updated android studio and plugins when sync, fails with could not create parent directory for lock file wrapper properties: #Sun Mar 05 16:51:59 PKT 2017 distributionBase= GRADLE_USER_HOME distributionPath=wrapper/ dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/ dists distributionUrl=https\://services.gradle.org/distributions/ gradle- 3.3-all.zip build.gradle app module: apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { applicationId "com.example.sarahn.toyapplication" minSdkVersion 17 targetSdkVersion 25 versionCode 1

API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'

时光毁灭记忆、已成空白 提交于 2019-11-27 09:17:29
I'm experiencing very annoying warning in my projects: WARNING: API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'. It will be removed at the end of 2019. For more information, see https://d.android.com/r/tools/task-configuration-avoidance. REASON: It is currently called from the following trace: ... WARNING: Debugging obsolete API calls can take time during configuration. It's recommended to not keep it on at all times. Affected Modules: app As this warning will become an error next year I'd like to fix it once and for all. I've