Various taste dependencies

I found the same duplicate question . But I have no dependency on maven. I have a dependency on a subproject.

I want to use one project dependency for only one flavor. This is my build.gradle

dependencies {
    secureCompile project(':relatedProjects:gd')
}

android {
    compileSdkVersion "Google Inc.:Google APIs:19"
    buildToolsVersion "18.1.1"

     productFlavors {
        google {}
        secure {
            packageName "com.some_secure.package"
        }
     }
}

This is the console from the build team.

./gradlew clean assembleDebug 

FAILURE: Build failed with an exception.

* Where:
Build file '/home/kulik/project/Notate/notateolearis/notateandroid/build.gradle' line: 27

* What went wrong:
A problem occurred evaluating project ':someproject'.
> Could not find method secureCompile() for arguments [project ':relatedProjects:gd'] on project ':someproject'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 15.957 secs
+4
source share
1 answer

The decision is based. Before using it, you should declare flavorings, so the correct layout is gradle:

   android {
       productFlavors {
           google {}
           secure {
               packageName "com.some_secure.package"
           }
       } 
       dependencies {
           secureCompile project(':relatedProjects:gd')
       }

       compileSdkVersion "Google Inc.:Google APIs:19"
       buildToolsVersion "18.1.1"
   }
+4
source

Source: https://habr.com/ru/post/1529592/


All Articles