1

I already success including my sub project lib to my main project, but I seems can't build my sub project lib, so I can't import it in my script.

when I look into directory /build/exploded-bundles/ after build everything

I found MyAndroidProjectStickyScrollViewItemsUnspecified.aar, along side with ComActionBarSherlockAxtionBarSherlock440.aar, which both have similar dir structure, both contain :

  • assets (dir),
  • res (dir),
  • AndroidManifest.xml,
  • classes.jar, and
  • R.txt

like this

MyAndroidProject
|- .idea
|- MyAndroid
|  |- build
|  |  |- exploded-bundles
|  |  |  |- ComActionBarSherlockAxtionBarSherlock440.aar
|  |  |  |- MyAndroidProjectStickyScrollViewItemsUnspecified.aar
|  |  |     |- assets
|  |  |     |- res
|  |  |     |- AndroidManifest.xml
|  |  |     |- classes.jar
|  |  |     |- R.txt
|  |  |- res
|  |  |- sources  
|  |- src
|  |- build.gradle
|  |- MyAndroid.iml
|- gradle
|- project-lib
|  |- StickyScrollViewItems
|     |- build
|     |- src
|     |  |- main
|     |     |- gen
|     |     |  |- com.emilsjolander.components.stickyscrollviewitems
|     |     |     |- BuildConfig.java
|     |     |     |- Manifest.java
|     |     |     |- R.java
|     |     |- java
|     |     |  |- com.emilsjolander.components.stickyscrollviewitems
|     |     |     |- StickyScrollView.java
|     |     |- res
|     |     |- AndroidManifest.xml
|     |- build.gradle
|     |- StickyScrollViewItems.iml
|- build.gradle
|- MyAndroidProject.iml
|- gradlew
|- gradle.bat
|- local.properties
|- settings.gradle
...

but while the ComActionBarSherlockAxtionBarSherlock440.aar's classes.jar contain the following package:

  • android.support.v4.app
  • com.actionbar.sherlock
  • META-INF

the MyAndroidProjectStickyScrollViewItemsUnspecified.aar's classes.jar is empty

here the settings.gradle of the root project

include ':MyAndroid', ':StickyScrollViewItems'

project(':StickyScrollViewItems').projectDir = "$rootDir/project-lib/StickyScrollViewItems" as File

here the build.gradle of MyAndroid

import groovy.transform.Field

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.6.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 18
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 18
    }
}

dependencies {
    compile 'com.android.support:support-v4:18.0.+'
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile 'com.squareup.picasso:picasso:2.1.1'
    compile 'com.github.snowdream.android:android-async-http:0.0.2'
    compile 'de.greenrobot:greendao:1.3.2'
    compile project(':StickyScrollViewItems')
}

and here is the build.gradle of StickyScrollViewItems

import groovy.transform.Field

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.6.+'
    }
}
apply plugin: 'android-library'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 18
    buildToolsVersion "17.0.0"
    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 18
    }
}

dependencies {
    compile 'com.android.support:support-v4:18.0.+'
}

what should I do so I can use

import com.emilsjolander.components.stickyscrollviews.R;
Ahmad Azwar Anas
  • 1,289
  • 13
  • 22
DeckyFx
  • 1,308
  • 3
  • 11
  • 32

1 Answers1

1

It's unclear of what you trying to achive, but most likely you should use @aar package instead of library project:

settings.gradle

include ':MyAndroid'


\MyAndroid\build.gradle

dependencies {
    compile 'se.emilsjolander:StickyScrollViewItems:1.0.0'
}

There is no resources for this library:

enter image description here

But classes is not empty, if you add library as maven dependency. Please, check if it's help.

enter image description here

If you need to modify library sources, than update library sources it looks like author added gradle support recently.

Sergii Pechenizkyi
  • 22,227
  • 7
  • 60
  • 71
  • Thanks, yes it may be added recently, but now i can include it using build.gradle, thanks @plastiv, upvoted and marked as correct, once again thanks – DeckyFx Nov 06 '13 at 05:31