/acme-android/app/build.gradle
apply plugin: 'com.android.application'
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
release {
storeFile = file(String.valueOf(System.getenv("ANDROID_BUILD_KEYSTORE_PATH")))
keyAlias = String.valueOf(System.getenv("ANDROID_BUILD_KEY_ALIAS"))
storePassword = String.valueOf(System.getenv("ANDROID_BUILD_KEYSTORE_PASSWORD"))
keyPassword = String.valueOf(System.getenv("ANDROID_BUILD_KEY_PASSWORD"))
}
debug {
storeFile = file(String.valueOf(System.getenv("ANDROID_BUILD_KEYSTORE_PATH")))
keyAlias = String.valueOf(System.getenv("ANDROID_BUILD_KEY_ALIAS"))
storePassword = String.valueOf(System.getenv("ANDROID_BUILD_KEYSTORE_PASSWORD"))
keyPassword = String.valueOf(System.getenv("ANDROID_BUILD_KEY_PASSWORD"))
}
}
useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.utec.serviciosgenerales"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.release
}
buildTypes {
release {
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
resValue 'string', 'MY_VAR_1', String.valueOf(System.getenv("MY_VAR_1"))
buildConfigField "int", "MY_VAR_2", System.getenv("MY_VAR_2")
}
debug {
resValue 'string', 'MY_VAR_1', String.valueOf(System.getenv("MY_VAR_1"))
buildConfigField "int", "MY_VAR_2", System.getenv("MY_VAR_2")
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.itlgl:iosdialog:1.0.1'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.android.volley:volley:1.1.1'
implementation('org.apache.httpcomponents:httpmime:4.3') {
exclude module: 'httpclient'
}
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'
}
import com.utec.serviciosgenerales.R;
import com.utec.serviciosgenerales.BuildConfig;
//int
BuildConfig.MY_VAR_2
//string
context_or_view.getResources().getString(R.string.MY_VAR_1);
https://www.tanelikorri.com/tutorial/android/set-variables-in-build-gradle/