【发布时间】:2018-02-16 07:42:22
【问题描述】:
我正在尝试将我的应用程序与 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
}
【问题讨论】:
-
CMake 优于实验性插件,Realm 不支持实验性插件。
-
通过在所有 jniLibs 文件夹( armeabi、armeabi-v5a、armeabi-v7a、mips、x86)中添加 .so 文件并添加 ndk { abiFilters "armeabi-v5a", "armeabi- v7a", "x86", "armeabi", "mips" } 默认配置
标签: android android-studio realm realm-mobile-platform epson