• 14
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I have an Android NDK project which builds libMyProject1.so and I am using:

set_target_properties(MyProject1
        PROPERTIES
        LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../Client/libs/${ANDROID_ABI}")

to export the built library to the folder that I need.

I also have another external shared library that I link with:

MyExternal library

add_library(MyExternal SHARED IMPORTED)
set_target_properties(MyExternal PROPERTIES IMPORTED_LOCATION        ${CMAKE_CURRENT_SOURCE_DIR}/../MyExternal/libs/${ANDROID_ABI}/libMyExternal.so)

target_link_libraries( # Specifies the target library.
        MyProject1
        # Shared Dependencies
        MyExternal
        # Links the target library to the log library
        # included in the NDK.
        ${log-lib})

libMyProject1.so is copied to Client/libs/${ANDROID_ABI} but libMyExternal.so is not copied. How to copy the external shared library to my client folder using cmake?

As suggested in the comments, the following worked for me:

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../MyExternal/libs/${ANDROID_ABI}/libMyExternal.so
        DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../Client/libs/${ANDROID_ABI})
  • 1
Reply Report

You should change the jniLibs.srcDirs, which will be packed by the gradle.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        ...
        ndk {
            abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a'
        }
        ...
    }
    ...
    sourceSets {
        main {
            // let gradle pack the shared library into apk
            jniLibs.srcDirs = ['Client/libs/']
        }
    }
    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }
}

dependencies {
   ...
}
  • 0
Reply Report