Android Development skipped pit-as import NDK project hint error No such property:sdkhandler for Class:com.android.build.gradle.LibraryPlugin

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.