Use different build types of Library Module in Android App Module in Android Studio and Gradle

后端 未结 4 1188
名媛妹妹
名媛妹妹 2020-12-13 19:53

I have a workspace containing several different apps and a common library project that I am looking to convert from Eclipse to Android Studio and from Ant to Gradle. Curren

4条回答
  •  暖寄归人
    2020-12-13 20:26

    Just link https://issuetracker.google.com/issues/36967265

    //in library Project build.gradle (lib): 
    apply plugin: 'com.android.library' 
    
    android { 
        publishNonDefault true 
    ... 
        buildTypes { 
            release { 
    ... 
            } 
            debug { 
    ... 
            } 
        } 
    } 
    dependencies { 
    ... 
    } 
    
    
    //in main Project build.gradle (application) 
    apply plugin: 'com.android.application' 
    
    android { 
    ... 
        buildTypes { 
            release { 
    ... 
            } 
            debug { 
    ... 
            } 
        } 
    } 
    dependencies { 
        debugCompile project(path: ':libName', configuration: "debug") 
        releaseCompile project(path: ':libName', configuration: "release") 
    ... 
    } 
    

提交回复
热议问题