I have library that is called sensorcore and I have another library (org.eclipse.paho.android.service-1.1.1.aar) that I would like to include it's classes inside the sensorcore aar that is built.(in sensorcore/build/output/arr/).
The library structure
-libraryFolder
--sensorcore
---build.gradle
--app
---build.gradle
--libs
---build.gradle
---paho.android.service.aar
-build.gradle
-settings.gradle
sensorcore/build.gradle
apply plugin: 'com.android.library'
def LIBRARY_VERSION = "1.2.8"
android {
compileSdkVersion 31
defaultConfig {
minSdkVersion 14
targetSdkVersion 31
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
groupId = "***"
artifactId = "***"
version = "${LIBRARY_VERSION}"
from components.release
}
}
repositories {
maven {
url "mavlink"
name "Git"
credentials(HttpHeaderCredentials) {
name = 'Job-Token'
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.work:work-runtime:2.7.1'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.5.0'
implementation 'com.google.android.gms:play-services-location:17.1.0'
implementation project(":libs")
}
app/build.gradle
apply plugin: 'com.android.application'
android {
signingConfigs {
releasekeystore {
keyAlias '***'
keyPassword '***'
storeFile rootProject.file('secrets/key.jks')
storePassword '***'
}
}
compileSdkVersion 31
defaultConfig {
applicationId "******"
minSdkVersion 14
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releasekeystore
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
implementation project(":sensorcore")
}
libs/build.gradle
configurations.maybeCreate("default")
artifacts.add("default", file('org.eclipse.paho.android.service-1.1.1.aar'))
libraryFolder build.gradle
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'maven-publish'
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
libraryFolder settings.gradle
include ':app', ':sensorcore', ':libs'
rootProject.name='Sensor'
when I'm trying just to build it using the gradle command "gradle clean build" it gives me an error
What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file 'libraryFolder\secrets\key.jks' not found for signing config 'releasekeystore'.
Is it possbile to "build" without the releasekey? maybe there is any command that can do it.
I didn't find any infomation in the gradle documentation, maybe I have missed it.
Anybody has any idea how to resolve it? thank you.
Related
I have been running into this error while trying to build my app and do not know how to resolve it, when I toggle Gradle offline mode, the error disappears but other dependency requires it to be turned off.
Could not GET 'https://google.bintray.com/exoplayer/com/google/gms/google-services/4.3.4/google-services-4.3.4.pom'. Received status code 502 from server: Bad Gateway
Disable Gradle 'offline mode' and sync project
This is my build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.6.1'
classpath 'com.android.tools.build:gradle:4.2.1'
classpath 'com.google.gms:google-services:4.3.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "https://jitpack.io" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my second buid.gradle
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.9'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
android {
signingConfigs {
release {
storeFile file('C:\\Users\\Osas Divine\\Desktop\\sckoolite\\unilorin-sckoolboy.jks')
storePassword '123456/'
keyAlias 'key0'
keyPassword '123456/'
}
}
compileSdkVersion 29
defaultConfig {
applicationId "com.sckoolboy.unilorin"
manifestPlaceholders = [onesignal_app_id: "d0989000-9ff3-4214-a42b-ed8f5a123456",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
minSdkVersion 19
targetSdkVersion 29
versionCode 11020
versionName '5.2.2'
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
archivesBaseName = "Sckoolboy"
useLibrary 'org.apache.http.legacy'
signingConfig signingConfigs.release
}
dexOptions {
jumboMode true
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.github.vivchar:ViewPagerIndicator:1.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.7.2'
implementation 'com.squareup.retrofit2:converter-gson:2.7.2'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.squareup.okhttp3:logging-interceptor:4.4.1'
..........
implementation('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'
// google maps library ------------------------------------------------------------------------
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation('com.google.android.libraries.places:places:1.0.0') {
exclude module: 'glide'
}
}
apply plugin: 'com.google.gms.google-services'
Facing errors on my Gradle build in Android Studio. Where do I need to change the code to fix the issue? I am new to android app development.
This is my project build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
}
allprojects {
repositories {
jcenter()
google()
maven { url 'https://jitpack.io' }
}
}
this is my app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.cisco.amp"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "2.0.0.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// Override versionName and versionCode if passed as arguments from build script
if (project.hasProperty("versionName")) {
versionName = project.property("versionName")
}
if (project.hasProperty("versionCode")) {
def versionCodeStr = project.property("versionCode")
if (versionCodeStr != null && !versionCodeStr.equals("")) {
versionCode = Integer.valueOf(versionCodeStr)
}
}
}
signingConfigs {
release {
if (project.hasProperty("keyAlias")) {
keyAlias = project.property("keyAlias")
}
if (project.hasProperty("keyPassword")) {
keyPassword = project.property("keyPassword")
}
if (project.hasProperty("storeFile")) {
storeFile = file(project.property("storeFile"))
}
if (project.hasProperty("storePassword")) {
storePassword = project.property("storePassword")
}
}
}
buildTypes {
debug {
testCoverageEnabled true
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
flavorDimensions "buildMode"
productFlavors {
automation {
dimension "buildMode"
applicationIdSuffix ".automation"
versionNameSuffix "-automation"
}
prod {
dimension "buildMode"
}
}
testOptions {
animationsDisabled true
}
jacoco {
version '0.8.4'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.material:material:1.1.0-alpha06'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha06'
implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
implementation 'androidx.annotation:annotation:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
testImplementation 'junit:junit:4.12'
testImplementation 'androidx.test:core:1.2.0'
androidTestImplementation 'androidx.test:core:1.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
}
Error logs:
Task :app:validateSigningAutomationRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:validateSigningAutomationRelease'.
> Keystore file not set for signing config release
Able to resolve the issue by commenting out following 2 blocks of dependencies from my app build.gradle
/*debug {
testCoverageEnabled true
}*/
and
/*jacoco {
version '0.8.4'
}*/
I'm developing an android application for my company. The project holds directories: our sdk (library in this case) and a sample app that imports the sdk. When I add product flavors to the sdk (library) the app breaks due to being unable to resolve the dependencies imported from the sdk.
The errors are:
error cannot find symbol class S
error cannot find symbol class SO
error package S does not exist
error method does not override or
implement a method from a supertype
Here is the top-level/project level build.gradle file
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.novoda:bintray-release:0.9'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here is the SDK/Library build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.novoda.bintray-release'
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName version
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultPublishConfig "nonlocationVersionRelease"
publishNonDefault true
flavorDimensions "version"
productFlavors {
nonlocation {
dimension "version"
}
location {
dimension "version"
}
}
buildTypes {
release {
minifyEnabled false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
lintOptions {
abortOnError false
}
}
configurations {
javadocDeps
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
}
publish {
userOrg = '*******'
groupId = 'com.*******.android'
artifactId = '*******'
publishVersion = '2.0.0'
desc = '******* sdk'
website = 'https://github.com/*******/*******-android-public-sdk'
}
and here is the app's build.gradle file:
apply plugin: 'com.android.application'
def computeVersionCode = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-list', 'HEAD', '--count'
standardOutput = stdout
}
return stdout.toString().trim().toInteger();
}
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.*******.demo"
minSdkVersion 15
targetSdkVersion 27
versionCode computeVersionCode()
versionName "1.0"
renderscriptTargetApi 20
renderscriptSupportModeEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
debugConfig {
storeFile file("debug.jks")
storePassword "*******"
keyAlias "com.*******.android"
keyPassword "*******"
}
releaseConfig {
storeFile file("release.jks")
storePassword "*******"
keyAlias "com.*******.android"
keyPassword "*******"
}
}
buildTypes {
debug {
signingConfig signingConfigs.debugConfig
}
release {
signingConfig signingConfigs.releaseConfig
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:preference-v7:27.1.1'
implementation 'com.google.guava:guava:23.0'
implementation 'com.squareup:seismic:1.0.2'
implementation 'net.hockeyapp.android:HockeySDK:3.7.0'
implementation 'jp.wasabeef:blurry:1.0.5'
implementation project(path: ':*******-sdk', configuration:'default')
}
I have been trying to fix this for 4 days and am still stuck. I've tried all of the typical solutions found on stackoverflow. This has been a cascade of problem after problem and this specific one came directly after updating how the sdk is loaded in the app's build.gradle file. I suspect something is wrong with this line where I import the sdk as a dependency (end of app's build.gradle):
implementation project(path: ':*******-sdk', configuration:'default')
but not including 'configuration: 'default'' causes another bug where the app cannot discern which buildVariant of the SDK to use.
How can I get my app up and running while also maintaining the product flavors found in the SDK?
I have project and I added another project as module and I have big problem with this error message:
Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge
dex
I tried many solutions in stackoverflow and google but i don't found an answer.
For example:
I try added to defaultConfig multiDexEnabled true.
I try to clean and rebuild.
I try to Invalidate catch/Restart and then rebuild.
My project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My app gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "adms.foxitpdf"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation files('libs/FoxitRDK.jar')
compile project(path: ':uiextensions_src')
}
And my module gradle:
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions{
abortOnError false
}
}
dependencies {
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
implementation files('src/libs/FoxitRDK.jar')
}
task clearAar(type: Delete){
delete '../FoxitRDKUIExtensions.aar'
}
task makeAar(type: Exec){
dependsOn(clearAar,build)
def fromFile = 'build/outputs/aar/'
def intoFile = '../'
if(org.gradle.internal.os.OperatingSystem.current().windows) {
commandLine "cmd",
'-/C', 'copy', file("$fromFile/uiextensions_src-release.aar").absolutePath, file("$intoFile/FoxitRDKUIExtensions.aar")
}else {
commandLine "cp",
file("$fromFile/uiextensions_src-release.aar").absolutePath, file("$intoFile/FoxitRDKUIExtensions.aar")
}
}
makeAar {}.dependsOn(clearAar,build)
task makeJavaDoc(type: Javadoc) {
List<String> mSourcePath = new ArrayList<String>();
mSourcePath.add("../../fsdk/app/src/main/java/com/foxit/sdk/");
mSourcePath.add("src/main/java/com/foxit/uiextensions/UIExtensionsManager.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/Module.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/pdfreader/impl/PDFReader.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/controls/menu/IMenuView.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/controls/menu/MoreMenuConfig.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/controls/menu/MoreMenuModule.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/controls/toolbar/IBaseItem.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/controls/toolbar/IBarsHandler.java");
mSourcePath.add("src/main/java/com/foxit/uiextensions/controls/propertybar/IMultiLineBar.java");
source = mSourcePath;
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
Properties properties = new Properties()
InputStream inputStream = project.rootProject.file('local.properties').newDataInputStream() ;
properties.load( inputStream )
//读取文件
def sdkDir = properties.getProperty('sdk.dir')
ext.androidJar = sdkDir + "/extras/android/support/annotations/android-support-annotations.jar"
classpath += project.files(ext.androidJar)
destinationDir = file("../../docs/api_reference_android")
failOnError false
}
makeJavaDoc {
options {
encoding "UTF-8"
charSet 'UTF-8'
author true
version true
memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PUBLIC
locale = "en"
title = "Document of RDK for Android"
// fsdk overview
Map<String,List<String>> map = new HashMap<>();
List<String> fsdkOverViews= new ArrayList<>();
fsdkOverViews.add("com.foxit.sdk");
fsdkOverViews.add("com.foxit.sdk.*");
map.put("Fsdk Packages",fsdkOverViews);
// UIExtensions overview
List<String> uiExtendOverViews = new ArrayList<>();
uiExtendOverViews.add("com.foxit.uiextensions");
uiExtendOverViews.add("com.foxit.uiextensions.*");
map.put("UIExtenstions Packages",uiExtendOverViews);
groups = map;
}
}
I use with Android Studio to 3.0
Someone have idea why?
I guess you need to include this below one to your gradle as well as add dependencies and include in manifest also. If you have enabled only in gradle and does not include in manifest and dependencies then give it a shot.
multiDexEnabled true
add to your dependencies
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
gradle file
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "adms.foxitpdf"
minSdkVersion 15
targetSdkVersion 24
versionCode 9
versionName "1.0"
multiDexEnabled true //Add this
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
Depending on how you override Application add this to your manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>
or we can just do like this and again include in manifest with name tag.
public class MyApplication extends SomeOtherApplication {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Read full story here
I've regularly used the archivesbasename to rename my output apk's but since using the google-services plugin it is being ignored. Is there anything I can do to get this working again.
Attached my full build.gradle below, be grateful for any pointers.
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
project.archivesBaseName = "MyApp";
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "org.codechimp.myapp"
versionCode 205
versionName "2.4"
minSdkVersion 14
targetSdkVersion 22
}
productFlavors {
prod {
}
dev {
versionName = android.defaultConfig.versionName + " dev"
}
}
signingConfigs {
debug {
storeFile file("debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
release }
buildTypes {
debug {
debuggable true
signingConfig signingConfigs.debug
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-annotations:22.2.0'
compile 'com.google.android.gms:play-services-drive:7.5.0'
compile 'com.google.android.gms:play-services-plus:7.5.0'
compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.google.android.gms:play-services-ads:7.5.0'
compile 'com.google.android.gms:play-services-identity:7.5.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.afollestad:material-dialogs:0.6.2.4'
compile 'com.google.code.gson:gson:2.3'
compile 'com.github.andrew-codechimp:androidutils:1.19'
}
def Properties props = new Properties()
props.load(new FileInputStream(file('signing.properties')))
if (props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
} else {
android.buildTypes.release.signingConfig = null
}
Project level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.google.gms:google-services:1.3.0-beta1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
}
This stopped working for me with android gradle plugin version 1.3.0 using 1.3.1 resolves it.
classpath 'com.android.tools.build:gradle:1.3.1'
Inside your build.gradle for the app you might have this.
android {
//...
defaultConfig {
//...
archivesBaseName = "myprojectname_v${versionName}_${versionCode}"
}
//...
}
If you want to change the APK name based on build type.
android {
//...
buildTypes {
special {
//...
archivesBaseName = "myprojectname_special_v${versionName}_${versionCode}"
}
}
//...
}