Patrick Mahoney
Patrick Mahoney

Reputation: 555

Trouble importing library project into Android Studio "Main Manifest Missing"

I've been researching this error a ton and can't seem to fix it... and it's been extremely frustrating...

My main build.gradle looks like this:

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

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 18
    buildToolsVersion "18.0.1"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 18
    }
}

dependencies {
    compile 'com.android.support:support-v4:18.0.0'
    compile project(":libraries:Android-RSS-Reader-Library")
    compile project(":libraries:cardslib")
}

And my main settings.gradle looks like:

include ':libraries:Android-RSS-Reader-Library',':MAPS'
include ':libraries:cardslib',':MAPS'

Which as far as I can tell, is correct...

I think the problem lies somewhere in the build.gradle of the library.

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

dependencies {
}

android {
    compileSdkVersion 18
    buildToolsVersion "18.0.1"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 17
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['library/src']
            resources.srcDirs = ['library/src']
            res.srcDirs = ['library/res']
        }
    }
}

It could have something to do with the library's project structure, which goes something like cardslib -> library,demo,doc,apk and the source of the library being in the library directory, but I can't figure out how to fix my build errors.

The library I'm trying to use is https://github.com/gabrielemariotti/cardslib

Has anyone run into a similar problem, and if so, any ideas on how to fix it?

Upvotes: 1

Views: 2278

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 364858

If you want to use this library you can simply add in your project build.gradle

dependencies {
    compile 'com.github.gabrielemariotti.cards:library:0.3.0'
}

instead of

dependencies {
     compile project(":libraries:cardslib")
}

If you want to use a local library source, put sources in a folder inside you project.

If you use this in your setting.gradle

include ':libraries:cardslib',':MAPS'

you have to put sources in this folder: libraries/cardslib

For cardslib build.gradle you can use the same released with the library.

https://github.com/gabrielemariotti/cardslib/blob/master/library/build.gradle

changing versionName and versionCode.

Upvotes: 2

Related Questions