Android Studio NDK error, couldn't find GLES3/gl3.h although it exist

前端 未结 3 1618
无人及你
无人及你 2021-01-21 22:39

I\'m trying to make an app on Android Studio that use the NDK and OpenGL ES 3.0.When I #include < GLES3/gl3.h >, the IDE has auto completion as I typing, I think it\'s a sign

相关标签:
3条回答
  • 2021-01-21 23:11

    Android ndk-bundle has openglES3 since api 18, but in arm platform.

    I mean, if you are going to compile your project in armV8_64, you must set your min sdk to 21. But if you are going to use armeabi or armeabiV7 the minimum api will be 18.

    So change your minSDK dependig on your preferences in the app/build.gradle file.

    I suggest you to define the API 21 and define your product flavours to support for all architectures, besides you can make other 3rdparty library linkings, the code should be something like this:

    android.productFlavors {
            // for detailed abiFilter descriptions, refer to "Supported ABIs" @
            // https://developer.android.com/ndk/guides/abis.html#sa
            create("arm") {
                ndk.abiFilters.add("armeabi")
                ndk.ldFlags.add("-L${file(''your_libraries_path'')}".toString())
                ndk.ldLibs.addAll(["your_armeabi_library"])
            }
            create("arm7") {
                ndk.abiFilters.add("armeabi-v7a")
                ndk.ldFlags.add("-L${file('your_libraries_path')}".toString())
                ndk.ldLibs.addAll(["your_armv7_library"])
            }
            create("arm8") {
                ndk.abiFilters.add("arm64-v8a")
                ndk.ldFlags.add("-L${file(''your_libraries_path')}".toString())
                ndk.ldLibs.addAll(["your_armv8_library"])
            }
    }
    

    This gradle code is from the gradle 0.8.3 experimental plugin, so if you have not this version, you need to make some changes to fit into your gradle version.

    0 讨论(0)
  • 2021-01-21 23:27

    For me I only have to change the minSdkVersion in build.gradle to 19.

    0 讨论(0)
  • 2021-01-21 23:27

    do not forget to set

    APP_PLATFORM := android-23 (or other depending on uelordi answer)

    to application.mk

    0 讨论(0)
提交回复
热议问题