build.gradle and project libs

喜夏-厌秋 提交于 2019-11-27 05:04:44

I think you are specifying the path to your library project incorrectly. If I'm interpreting your project layout correctly the line should be the following:

compile project(':MyApp:libraries:projectLib')

When you start a project path with ':' you are making an absolute path from the root project and then basically just writing a path with ':' instead of '/'. In this case your projectLib module is in the directory MyProject/MyApp/libraries/projectLib, and MyProject is where your settings.gradle is, making it your root project. So swapping in colons for slashes gets you the line I wrote above.

You'll need to modify your settings.gradle to include the full path as well:

include 'MyApp:libraries:projectLib'

Finally, if you want to save some typing for stuff like your repository configuration you can put it in an allproject block in your root project.

allprojects {
    repositories {
        mavenCentral()
    }
}

A lot of nice little tips like that covered in the multi-module docs.

After long researches, several settings and the help of Josh, I solved my problem that is describes in the question above.

Now here my solution:

  • set gradle version in your build.gradle files to 0.4.2
  • use for support-library (e.g.: v4) "com.android.support:support-v4:13.0.0" (like its described here)
  • in my case I had to install the "Android Support Repository" and "Google Repository" with the SDK Manager
  • with the last edited gradle files (Edit 3) in my question --> my build was successful
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!