我在github https://github.com/joaopedronardari/OpenCV-AndroidSamples中克隆项目时遇到问题,并且出错。我不知道该项目可能已过期或发生了什么。但它是3年前上传的。请协助解决我的问题,感谢所有回答我问题的人(回答并修正我的说法) 这是gradle
构建gradle(应用程序):
apply plugin: 'com.android.application'
model {
android {
compileSdkVersion = 22
buildToolsVersion = "23.0.0"
defaultConfig.with {
applicationId = "com.jnardari.opencv_androidsamples"
minSdkVersion.apiLevel = 10
targetSdkVersion.apiLevel = 22
versionCode = 1
versionName = "1.0"
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.pro')
}
}
/*
* native build settings
*/
android.ndk {
moduleName = "ndklibrarysample"
cppFlags += ["-std=c++11", "-fexceptions", "-frtti"]
cppFlags += "-I${file("C:/Users/jnardari/Desktop/OpenCV-android-sdk/sdk/native/jni/include")}".toString()
ldLibs += ["android", "EGL", "GLESv2", "dl", "log", "z"]
stl = "gnustl_static"
}
android.productFlavors {
create("arm") {
ndk.with {
abiFilters += "armeabi"
File curDir = file('./')
curDir = file(curDir.absolutePath)
String libsDir = curDir.absolutePath + "\\src\\main\\jniLibs\\armeabi\\"
ldLibs += libsDir + "libopencv_java3.so"
}
}
create("armv7") {
ndk.with {
abiFilters += "armeabi-v7a"
File curDir = file('./')
curDir = file(curDir.absolutePath)
String libsDir = curDir.absolutePath + "\\src\\main\\jniLibs\\armeabi-v7a\\"
ldLibs += libsDir + "libopencv_java3.so"
}
}
create("x86") {
ndk.with {
abiFilters += "x86"
File curDir = file('./')
curDir = file(curDir.absolutePath)
String libsDir = curDir.absolutePath + "\\src\\main\\jniLibs\\x86\\"
ldLibs += libsDir + "libopencv_java3.so"
}
}
create("mips") {
ndk.with {
abiFilters += "mips"
File curDir = file('./')
curDir = file(curDir.absolutePath)
String libsDir = curDir.absolutePath + "\\src\\main\\jniLibs\\mips\\"
ldLibs += libsDir + "libopencv_java3.so"
}
}
create("fat") {
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile project(':libraries:opencv')
}
构建gradle(项目):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
}
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
allprojects {
repositories {
jcenter()
}
}
这是gradle-wrapper:
#Sun Jul 22 04:30:58 ICT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
答案 0 :(得分:1)
进行以下代码更改:
compileSdkVersion 27
minSdkVersion 19
targetSdkVersion 27
implementation 'com.android.support:appcompat-v7:27.1.1'
还有另一件事,您正在尝试在Android Studio 3.0中打开与Android Studio 2.0中开发的项目相同的项目。而不是打开项目。尝试导入项目。我不确定android studio的迁移,但肯定会造成问题。我没有任何相关文章,但尝试找出一些问题。
答案 1 :(得分:0)
嗯...这个项目似乎已经过时,要么要求维护者更新该项目,要么找到另一个项目。我不是gradle的专家,但是我知道您会浪费时间来修复gradle文件。
编辑:我尝试了@Mbuodile Obiosio的解决方案,但是没有用。