我正在按照本教程https://www.sitepoint.com/face-detection-in-android-with-google-play-services/一步一步。錯誤:無法找到符號類生成器
不過,我正面臨着一些我無法通過計算器解決的錯誤。
該條帶麻煩代碼如下:
super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
InputStream stream = getResources().openRawResource(R.raw.image01);
Bitmap bitmap = BitmapFactory.decodeStream(stream);
FaceDetector detector = new FaceDetector.Builder(getApplicationContext())
.setTrackingEnabled(false)
.build();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//create a frame from the bitmap and run face detection on the frame
Frame frame = new Frame.Builder().setBitmap(bitmap).build();
SparseArray<Face> faces = detector.detect(frame);
TextView faceCountView = (TextView) findViewById(R.id.face_count);
faceCountView.setText(faces.size() + "faces detected");
detector.release();
和我得到這些錯誤:?
C:\Users\XXX\FaceDetectionDemo\app\src\main\java\com\example\XXX\facedetectiondemo\MainActivity.java Error:(40, 49) error: cannot find symbol class Builder Error:(51, 21) error: cannot find symbol class Face Error:(51, 43) error: cannot find symbol method detect(Frame) Error:(56, 17) error: cannot find symbol method release() Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
的build.gradle具有正確的依賴
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services:8.1.0'
}
我與此項cannot find symbol class "Builder"enter image description here uilder試圖RQ = 1,但它不起作用
[SDK TOOLS INSTALLED]
更新您的Google Play服務的lib ...依賴{ 編譯「com.google.android.gms:發揮服務:9.0。 1' } –
但後來我得到另一個錯誤。即使當lib被實現時也是如此。 錯誤:(26,13)無法解析:com.google.android.gms:發揮服務:9.0.1 Install Repository and sync project
Show in File
Show in Project Structure dialog – FCRPS
,當我嘗試 '更新'(因爲它已經更新)。我得到: 正在加載SDK信息... 忽略未知的包過濾器'extra-google-m2repository'警告:包過濾器刪除了所有包。沒有什麼可安裝的。 請考慮嘗試在沒有包過濾器的情況下再次更新。 – FCRPS