Ich habe eine Anwendung, die vollständig entwickelt ist. Jetzt muss ich in mipmap
Ordner nur gleiche Anwendung mit minimalen Änderungen erstellen und strings.xml
ProductFlavours mit nur Ressourcenwechsel
Ich habe Artikel Flavors in build.gradle erstellt als
apply plugin: 'com.android.application'
apply plugin: 'sonar'
apply plugin: 'sonar-runner'
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "16.1.1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
productFlavors {
flavour1 {
buildConfigField "String", "BASE_SERVER_URL", '"http://flavour1.com"'
buildConfigField "String", "CITY_ID", "1"
}
flavour2 {
buildConfigField "String", "BASE_SERVER_URL", '"http://flavour2.com"'
buildConfigField "String", "CITY_ID", "2"
}
}
}
repositories {
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.eftimoff:androidplayer:[email protected]'
compile 'com.nineoldandroids:library:2.4.0'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.google.code.gson:gson:2.4'
compile 'com.viewpagerindicator:library:[email protected]'
compile 'se.emilsjolander:stickylistheaders:2.5.2'
compile('org.simpleframework:simple-xml:2.7') {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
compile files('libs/xmlutils.jar')
compile 'cc.cloudist.acplibrary:library:1.2.1'
compile 'com.github.castorflex.smoothprogressbar:library:1.1.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile files('libs/json-20140107.jar')
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:[email protected]') {
transitive = true
}
compile 'com.github.d-max:spots-dialog:[email protected]'
compile files('libs/aws-android-sdk-1.0.4-debug.jar')
}
und modifizierte meine Ordnerstruktur als
Project
--/app
--/src
--/flavour1
--/res
--strings.xml
--/flavour2
--/res
--strings.xml
--/main
--/java
--/res
--/AndroidManifest.xml
und dann bekomme ich 2 Fehler
EDIT:
Geänderte Ordnerstruktur wie unten als
Project
--/app
--/src
--/flavour1
--/res
--/values
--strings.xml
--/flavour2
--/res
--/values
--strings.xml
--/main
--/java
--/res
--/AndroidManifest.xml
"public static final String PAID_DETAILS = "p ändern müssen, verwenden";" - Wo ist das vorhanden? – takrishna
in einer meiner Klassen, es funktionierte gut, wenn es keine Productflavours gab –