Received an NDK project to debug, after import found always prompt error
Error: (PNS, 1) A problem occurred evaluating project ': Libuvccamera '.
> No such property:sdkhandler for Class:com.android.build.gradle.LibraryPlugin
Baidu on various statements, there is said to reduce the gadle version, there is said to be in the environment variable configuration ANDROID_NDK path, the test is not, the last reference to others ndk Gradle file modified as follows:
Before it was modified:
Task Ndkbuild (type:exec, Description: ' Compile JNI source via NDK ') {
println (' Executing ndkbuild ')
def ndkbuildingdir = Project.plugins.findPlugin (' com.android.library '). Sdkhandler.getndkfolder (). Absolutepath
def Ndkbuildpath = Ndkbuildingdir
if (os.isfamily (os.family_windows)) {
Ndkbuildpath = Ndkbuildingdir + '/ndk-build.cmd '
} else {
Ndkbuildpath = Ndkbuildingdir + '/ndk-build '
}
CommandLine Ndkbuildpath, '-j8 ', '-C ', file (' Src/main '). Absolutepath
}
can be modified to
Task Ndkbuild (type:exec, Description: ' Compile JNI source via NDK ') {
println (' Executing ndkbuild ')
def ndkbuildingdir = Android.ndkdirectory
if (os.isfamily (os.family_windows)) {
Ndkbuildingdir = "$ndkBuildingDir/ndk-build.cmd"
} else {
Ndkbuildingdir = "$ndkBuildingDir/ndk-build"
}
CommandLine ndkbuildingdir, '-j8 ', '-C ', file (' Src/main '). Absolutepath
}
or fix it instead.
Task Ndkbuild (type:exec, Description: ' Compile JNI source via NDK ') {
println (' Executing ndkbuild ')
def ndkbuildingdir = Project.plugins.findPlugin (' com.android.library '). Sdkhandler.getndkfolder (). Absolutepath
def Ndkbuildpath = Ndkbuildingdir
def Ndkbuildpath = Android.ndkdirectory
if (os.isfamily (os.family_windows)) {
CommandLine "$ndkBuildPath/ndk-build.cmd",
'-C ', file (' Src/main '). Absolutepath,//change Src/main/jni the relative path to your JNI source
'-j ', Runtime.runtime.availableProcessors (),
' All ',
' Ndk_debug=1 '
} else {
CommandLine "$ndkBuildPath/ndk-build",
'-C ', file (' Src/main '). Absolutepath,//change Src/main/jni the relative path to your JNI source
'-j ', Runtime.runtime.availableProcessors (),
' All ',
' Ndk_debug=1 '
}
}
Android Development skipped pit-as import NDK project hint error No such property:sdkhandler for Class:com.android.build.gradle.LibraryPlugin