Using Flavors in gradle when importing project from Eclipse to Android Studio -


for 2 days im trying create 2 different flavors in android app. imported app android studio eclipse. created 2 res folders (res_testing , res_distribution) , 2 src folders (src_testing , src_distribution). how build.gradle looks like:

buildscript {   repositories {       mavencentral()   }   dependencies {     classpath 'com.android.tools.build:gradle:0.5.+'   } } apply plugin: 'android'  task wrapper(type: wrapper) {     gradleversion = '1.6' }  dependencies {     compile filetree(dir: 'libs', include: '*.jar') }  android {   compilesdkversion 17   buildtoolsversion "18.0.1"    sourcesets {     main {         manifest.srcfile 'androidmanifest.xml'         java.srcdirs = ['src']         resources.srcdirs = ['src']         aidl.srcdirs = ['src']         renderscript.srcdirs = ['src']         res.srcdirs = ['res']         assets.srcdirs = ['assets']     }      productflavors {         flavor1 {             packagename = 'com.comp.4u.testing'         }         flavor2 {             packagename = 'com.comp.4u'         }     }     android.sourcesets.flavor1{         java.srcdirs = ['src_testing']         resources.srcdirs = ['res_testing']     }     android.sourcesets.flavor2{         java.srcdirs = ['src_distribution']         resources.srcdirs = ['res_distribution']     }     instrumenttest.setroot('tests')   } } 

but when change build varients, although app builds ok, still using same datamanager file in main src folder (though 2 different packages according names gave them).

its driving me crazy!! looked in 100 forums , posts, no luck.

each datamanager using different url server. thing want.

i had similar problem.

what happens when remove data main folder overriden in flavors? error url not found? if yes, think same error get.

i solved problem creating new project , copying files it. think there still problems exporting projects eclipse , importing as.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -