Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project doesn't build #1

Open
waqas-ansari opened this issue May 6, 2018 · 4 comments
Open

Project doesn't build #1

waqas-ansari opened this issue May 6, 2018 · 4 comments

Comments

@waqas-ansari
Copy link

I exactly followed what is written in the example, but project won't build. It gives error in find_package(OpenCV REQUIRED)

The error says
Could not find the file OpenCVConfig.cmake although I copied them into the folder. I am quite new in this, therefore making a issue for you to help me out.

@sverbach
Copy link

I also had trouble building this project (on Windows 10) as it was created with an (now) older Android Studio version.
After some hours I managed to get it running, so I've prepared a little guide below:

Step 0: Prerequisites

Assuming you've just cloned the fmo-android repo, make sure you

Step 1: Settings in Android Studio

  • Use Android NDK version 16.1.4479499 (in SDK Manager -> SDK Tools)
  • Use CMake version 3.6.4111459 (in SDK Manager -> SDK Tools)
  • Use Android Gradle Plugin Version 2.3.2 and Gradle Version 3.4 (File -> Project Structure)
  • Do NOT use newer Versions, even when prompted by Android Studio

Step 2: Changing Some Files

  1. After applying the settings above you'll probably get a prompt saying stuff like "Gradle Version 2.3.2 not found", so make sure your ./build.gradle file looks like this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
  1. It can appear that one .cpp file won't compile due to an unused "this", if that's the case you can simply remove it. I don't remember exactly which file it was, but it looks something like this:
    ....
    [this, somethingElse] = foo();
    bar(somethingElse);

change that sequence to

    ....
    [somethingElse] = foo();
    bar(somethingElse);

Finished 🎉

With these settings it was no issue getting this project to run on all of my devices which have the latest Android Studio installed.
Hopefully this will help some someone :)

@marslannasr7koncepts
Copy link

Hi @sverbach.

I am following all these versions and related other things but still getting error NDK is missing a "platforms" directory.

I have no idea how to resolve this issue Tried my best but not able to build code and run an apk in my Device.

Waiting for your response.

Thanks

I also had trouble building this project (on Windows 10) as it was created with an (now) older Android Studio version.
After some hours I managed to get it running, so I've prepared a little guide below:

Step 0: Prerequisites

Assuming you've just cloned the fmo-android repo, make sure you

Step 1: Settings in Android Studio

  • Use Android NDK version 16.1.4479499 (in SDK Manager -> SDK Tools)
  • Use CMake version 3.6.4111459 (in SDK Manager -> SDK Tools)
  • Use Android Gradle Plugin Version 2.3.2 and Gradle Version 3.4 (File -> Project Structure)
  • Do NOT use newer Versions, even when prompted by Android Studio

Step 2: Changing Some Files

  1. After applying the settings above you'll probably get a prompt saying stuff like "Gradle Version 2.3.2 not found", so make sure your ./build.gradle file looks like this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
  1. It can appear that one .cpp file won't compile due to an unused "this", if that's the case you can simply remove it. I don't remember exactly which file it was, but it looks something like this:
    ....
    [this, somethingElse] = foo();
    bar(somethingElse);

change that sequence to

    ....
    [somethingElse] = foo();
    bar(somethingElse);

Finished 🎉

With these settings it was no issue getting this project to run on all of my devices which have the latest Android Studio installed.
Hopefully this will help some someone :)

@sverbach
Copy link

Hi @marslannasr7koncepts

I also had this error message first, I think it means that it couldn't locate the Android NDK.
Please make sure the NDK version 16.1.4479499 (and CMake) is installed in the SDK Manager.

After that, make sure you point to the correct version in the project -> Under "Project Structure" -> Android NDK Location.
If it still appears, try either:

  • Rebuilding (Build -> Rebuild Project)
  • Invalidate Cache (File -> Invalidate Caches / Restart)

Hope that helps.

Best,
Sven

@marslannasr7koncepts
Copy link

Hi @sverbach

I am getting this error when rebuilding the Project Please check it and Let me know if any solution.

Build file 'C:\Users\ArslanNasr\Downloads\fmo-android-master\fmo-android-master\app\build.gradle' line: 6

A problem occurred evaluating project ':app'.

Could not find method ndkVersion() for arguments [16.1.4479499] on object of type com.android.build.gradle.AppExtension.

Hi @marslannasr7koncepts

I also had this error message first, I think it means that it couldn't locate the Android NDK.
Please make sure the NDK version 16.1.4479499 (and CMake) is installed in the SDK Manager.

After that, make sure you point to the correct version in the project -> Under "Project Structure" -> Android NDK Location.
If it still appears, try either:

  • Rebuilding (Build -> Rebuild Project)
  • Invalidate Cache (File -> Invalidate Caches / Restart)

Hope that helps.

Best,
Sven

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants