0

I decided to download android studio because of pretty good look and popularity. First problem i met is adding external library. Most tutorials are for older versions. Things i did:

  • Created 'libraries' directory and put THIS library inside enter image description here

  • Inside settings.gradle added

include ':app:libraries:drawer'
  • Inside src in build.gradle added
compile project(':app:libraries:drawer')

under

dependencies

After pressing "sync project wih gradle files" i got:

Gradle 'SCR' project refresh failed:
         Cause: cannot get property 'compileSdkVersion' on extra properties extension as it does not exist

Pastebin sourcefiles:

settings.gradle inside project: http://pastebin.com/NvuPG1St

build.gradle inside project: http://pastebin.com/AT0Kjj8F

build.gradle inside src: http://pastebin.com/HjTKUazU

What should i do?

Stramek
  • 305
  • 1
  • 3
  • 14

2 Answers2

0

Use this structure:

root
  app
     build.gradle
  libraries
     drawer
       build.gradle
  build.gradle
  settings.gradle

Change your settings.gradle with

include ':app'
include ':libraries:drawer'

Change dependency in your app/build.gradle

compile project(':libraries:drawer')

In build.gradle inside the drawer you have to specify your sourceset inside the android block.

android {

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['aidl']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
}

UPDATE (after your images):

In your drawer/build.gradle you are using:

compileSdkVersion parent.ext.compileSdkVersion
buildToolsVersion parent.ext.buildToolsVersion

You should define in your root/build.gradle

ext {
    compileSdkVersion = 19 
    buildToolsVersion = "19.0.3"
}

and change the drawer/build.gradle in:

compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • Did as you said, still same problem :( I made some screenshots: https://www.dropbox.com/sh/w7nmihvzbrvudud/Aci6HGXuAN#/ – Stramek Mar 26 '14 at 19:47
  • Didn't help, any other ideas? https://www.dropbox.com/sh/phrfsd2tkgtpccg/OKEdZRDg1j#/ – Stramek Mar 27 '14 at 12:25
  • Yes. You have to check your error message. Now it is different. You are using the same logic with minSdkVesion with parent.ext.minSdkVersion.Change it. – Gabriele Mariotti Mar 27 '14 at 12:39
  • Like this? https://www.dropbox.com/s/xctx5ovtgo6mrp9/Zrzut%20ekranu%202014-03-27%2013.47.19.png Still same error like in problem #2 – Stramek Mar 27 '14 at 12:50
  • yes, but you have to define it in your gradle.build in the root folder or you can use gradle.properties. – Gabriele Mariotti Mar 27 '14 at 12:52
  • I think I'm doing it wrong way. I have tried to add this fragment of code: http://pastebin.com/Tqqiy5ma and because of no effects i think I need to extend this fragment somehow: http://pastebin.com/GMcVu024 I'm sorry, these questions may be silly for you, but if we fix it out I'll write small guide for others. – Stramek Mar 27 '14 at 21:45
0

Controlling Android properties of all your modules from the main project

// SDK Version and Build Tools used by all subprojects
ext {
   compileSdkVersion = 21
   buildToolsVersion = '21.1.2'
}
Chathura Wijesinghe
  • 3,310
  • 3
  • 25
  • 41