当前位置: 首页 > 工具软件 > Espresso.js > 使用案例 >

android node编码,android studio中的Node.js

谷梁宝
2023-12-01

我正在浏览Node.js示例

https://code.janeasystems.com/nodejs-mobile/getting-started-android

我不断地出现错误“error:Could not get unknown property'jniLibs'for source set'main'of type org.gradle.api.tasks.SourceSet.”

我的libnode文件夹与build.gradle文件处于同一级别:app/libnode和app/build.gradle

我是第一次使用android studio,所以我在这里的深度不够:)

这是我的build.gradle文件,它是出现错误的地方:

apply plugin: 'com.android.application'

android {

compileSdkVersion 29

buildToolsVersion "29.0.0"

defaultConfig {

applicationId "com.example.myapplication"

minSdkVersion 23

targetSdkVersion 29

versionCode 1

versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

externalNativeBuild {

cmake {

cppFlags ""

arguments "-DANDROID_STL=c++_shared"

}

}

ndk {

abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"

}

}

buildTypes {

release {

minifyEnabled false

proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

}

}

externalNativeBuild {

cmake {

path "src/main/cpp/CMakeLists.txt"

version "3.10.2"

}

}

}

// If you want Gradle to package prebuilt native libraries

// with your APK, modify the default source set configuration

// to include the directory of your prebuilt .so files as follows.

sourceSets {

main {

jniLibs.srcDirs './libnode/bin/'

}

}

dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.0.2'

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

testImplementation 'junit:junit:4.12'

androidTestImplementation 'androidx.test:runner:1.2.0'

androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

}

提前谢谢你的帮助。

 类似资料: