0

I am trying to install Android-GPU-Image in my project. https://github.com/CyberAgent/android-gpuimage

When I download the source, it's broken down as such:

enter image description here

The github project does not include install instructions (other than a dependency line that didn't work for me) so I am trying to figure out how to install a package like this.

My question is: What is the general name of this 'android-gpuimage' folder in the context of adding it to a project? Is this a Module, Sub-Project, Library-Project or what?

Update

Here is my gradle file

import java.util.regex.Pattern

apply plugin: 'android'

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.1'
    }
}

project.ext {
    multiarch = false
    compileSdkVersion = Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
    minSdkVersion = Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
    targetSdkVersion = Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
    buildToolsVersion = project.ANDROID_BUILD_TOOLS_VERSION
}

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.android.support:support-v4:22.0.0'
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.2.3'
    compile project(':CordovaLib')
    compile project(':app-FacebookLib')
    compile files('libs/universal-image-loader-1.9.3.jar')
    compile files('libs/twitter4j-core-4.0.3.jar')
    compile files('libs/twitter4j-core-4.0.4-SNAPSHOT.jar')
    compile files('libs/Filters.jar')
}

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

    defaultConfig {
        versionCode Integer.parseInt("" + getVersionCodeFromManifest() + "0")
    }

    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

    if (multiarch || System.env.BUILD_MULTIPLE_APKS) {
        productFlavors {
            armv7 {
                versionCode defaultConfig.versionCode + 2
                ndk {
                    abiFilters "armeabi-v7a", ""
                }
            }
            x86 {
                versionCode defaultConfig.versionCode + 4
                ndk {
                    abiFilters "x86", ""
                }
            }
            all {
                ndk {
                    abiFilters "all", ""
                }
            }
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

}

task wrapper(type: Wrapper) {
    gradleVersion = '1.12'
}

def getVersionCodeFromManifest() {
    def manifestFile = file(android.sourceSets.main.manifest.srcFile)
    def pattern = Pattern.compile("versionCode=\"(\\d+)\"")
    def matcher = pattern.matcher(manifestFile.getText())
    matcher.find()
    return Integer.parseInt(matcher.group(1))
}

Answer:

Needed to add

repositories {
    mavenCentral()
}

To my gradle, the one I already had was in the build script, I needed it outside that scope too.

https://stackoverflow.com/a/16675271/3324388

Community
  • 1
  • 1
Aggressor
  • 13,323
  • 24
  • 103
  • 182

1 Answers1

1

What you have checked out of github is the entire project , which containes the library project and a sample project showing how to use the library.

To use the library , you would have to include the dependency in gradle as mentioned

 dependencies {
    compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.2.3'
}

The gradle file lets you know what kind of project it is for example ,a library project would have

apply plugin: 'com.android.library'

and the main application project would have

apply plugin: 'com.android.application'
rahul.ramanujam
  • 5,608
  • 7
  • 34
  • 56
  • For the first part about dependencies I got this error: http://stackoverflow.com/questions/30764047/installing-android-gpu-image-error-could-not-resolve-all-dependencies For the second part about apply plugin, is there a place I could read about that more? I don't understand what that is doing and where that goes. Thanks for these insights though I've been stuck for a long time on this! – Aggressor Jun 10 '15 at 20:37
  • dont import the project folder , use the compile dependency in gradle to use the library. gradle will download the depdency for you – rahul.ramanujam Jun 10 '15 at 20:41
  • If I just put in the dependency I get this error `Failed to resolve: jp.co.cyberagent.android.gpuimage:gpuimage-library:1.2.3` – Aggressor Jun 10 '15 at 20:44
  • can you post your gradle file ? – rahul.ramanujam Jun 10 '15 at 20:45
  • does your project run if you remove the cyberagent dependency – rahul.ramanujam Jun 10 '15 at 20:49
  • Yup runs like butter :) (melted butter haha) – Aggressor Jun 10 '15 at 20:50
  • So you're saying, under normal project settings, to install this all you need to do is add that dependency line? – Aggressor Jun 10 '15 at 20:52
  • yeah , just like you are using other libraries – rahul.ramanujam Jun 10 '15 at 20:53
  • So you didn't install or copy anything locally, all you did was add that dependency line? – Aggressor Jun 10 '15 at 20:53
  • Interesting, our project uses Cordova so we must have some setup configuration mucking with this. :/ – Aggressor Jun 10 '15 at 20:55
  • am not sure about the cordova integration , but If you are using gradle it should be the same , – rahul.ramanujam Jun 10 '15 at 20:58
  • How does it get compile time code with this dependency? Is it downloading a local version of it? Because the error is pointing it can't find it locally `Searched in the following locations: file:/Applications/android-sdk-macosx/extras/android/m2repository/jp/co/cyberagent/android/gpuimage/gpuimage-library/1.2.3/gpuimage-library-1.2.3.pom` – Aggressor Jun 10 '15 at 20:59
  • Interestingly when I created a new project from scratch and added the dependency it also worked. However it is not downloading properly in my Cordova setup. This narrows it down at least. – Aggressor Jun 10 '15 at 21:36
  • 1
    Figured it out, thanks for the help it made a huge difference – Aggressor Jun 10 '15 at 22:06