[英]Error:Execution failed for task ':app:compileDebugNdk'. > Error: Your project contains C++ files but it is not using a supported native build system
我正在尝试将我的应用程序与EPSON热敏打印机TM-T82集成。 我的应用程序将领域用于本地数据库。 我按照他们的文档尝试集成打印机,但出现此错误。 我使用了EPOS2.jar文件和libepos2.so文件
错误:任务':app:compileDebugNdk'的执行失败。
错误:您的项目包含C ++文件,但未使用受支持的本机生成系统。 考虑使用CMake或ndk-build集成。 有关更多信息,请访问: https : //d.android.com/r/studio-ui/add-native-code.html或者,您可以使用实验性插件: https : //developer.android.com/r /tools/experimental-plugin.html
app:build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '26.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.swishpay.tab"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
sourceSets { main { jni.srcDirs = ['src/main/jni', 'src/main/jniLibs/'] } }
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
flatDir {
dirs 'libs'
}
maven {
url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
}
}
dataBinding {
enabled = true
}
dexOptions {
incremental true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:design:27.0.2'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.android.support:cardview-v7:27.0.2'
compile 'com.android.support:recyclerview-v7:27.0.2'
compile 'com.android.support:multidex:1.0.2'
compile 'com.facebook.stetho:stetho:1.5.0'
compile 'com.android.support.constraint:constraint-layout:1.1.0-beta5'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.facebook.stetho:stetho:1.5.0'
compile 'com.uphyca:stetho_realm:2.0.0'
compile 'com.google.android.gms:play-services:11.8.0'
compile 'com.google.android.gms:play-services-location:11.8.0'
compile 'com.pusher:pusher-java-client:1.5.0'
compile 'com.daimajia.swipelayout:library:1.2.0@aar'
testCompile 'junit:junit:4.12'
compile files('libs/Sam4sAndroidSDK.jar')
implementation 'com.github.bumptech.glide:glide:4.4.0'
compile(name: 'MswipeWseriesUniversalDRDSDKVer1.0.6v3.3.0', ext: 'aar')
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
implementation files('libs/simplyprintapi-android-1.3.0.jar')
compile 'com.github.freshdesk:freshchat-android:1.2.1'
implementation files('libs/ePOS2.jar')
}
apply plugin: 'realm-android'
apply plugin: 'com.google.gms.google-services'
项目:build.gradle
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "io.realm:realm-gradle-plugin:4.2.0"
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
您必须添加c ++支持才能在项目中使用c ++文件。 请确保您的项目有此支持。 您可以通过此链接将C和C ++代码添加到您的项目中,希望它会有用。
ndk {
abiFilters "armeabi-v5a", "armeabi-v7a", "x86", "armeabi", "mips"
}
将其添加到gradle默认配置中,并在jniLibs中创建这些文件夹,并将* .so文件粘贴到所有文件夹中。 这将启用对多个ndk的支持
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.