我正在尝试将openCV导入android studio2.1.3

时间:2016-09-19 21:25:21

标签: android opencv import module

package com.example.sawsanalzoubi.vision;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

所以在“import org.opencv.android.OpenCVLoader”中我遇到以下错误:

unused import statement  

import org.opencv.android.OpenCVLoader;
public class MainActivity extends AppCompatActivity {
private static  final String TAG="MainActivity";
static
{
if(!OpenCVLoader.initDebug){Log.d(TAG,"OpenCV not loaded");
}
    else
{
     Log.d(TAG,"OpenCV loaded");
 }
}
static{ System.loadLibrary("opencv_java3"); }
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}
}

this is a picture of the code this is the video that I have followed

现在我的错误是:

 1)Error:Dependency Vision:openCVLibrary300:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency. File: C:\Users\...\outputs\apk\openCVLibrary300-release-unsigned.apk

2)Error:Library projects cannot set applicationId. applicationId is set to 'com.example.user.vision' in default config.

我已经尝试过我找到的所有东西 this method 这一个a solution to a similar question 仍然没有任何效果

1 个答案:

答案 0 :(得分:0)

所以我最终在this person

的帮助下解决了这个问题

当您尝试使用以下命令添加作为APK的依赖项时,会出现错误:     apply plugin:' com.android.application' 告诉Gradle将其构建为应用程序,使用以下方式生成APK:

申请插件:' com.android.library' 它将构建为库,生成AAR。 有关详情,请查看this link