我正在尝试在我的应用程序中实现CWAC2相机活动来替换标准相机,但是在使用以下代码调用相机时遇到以下问题:
Intent i = new CameraActivity.IntentBuilder(TestActivity.this)
.skipConfirm()
.facing(Facing.BACK)
.facingExactMatch()
.to(new File(Constants.MEDIA_DIR, "landscape-rear.jpg"))
.updateMediaStore()
.flashModes(FLASH_MODES)
.zoomStyle(ZoomStyle.SEEKBAR)
.debugSavePreviewFrame()
.debug()
.build();
startActivityForResult(i, REQUEST_PORTRAIT_RFC);
错误跟踪:
E / AndroidRuntime:致命异常:主要 处理:za.co.scsit.i_oncloud,PID:14419 主题:主题:{com.facebook.orca = overlay:com.cyngn.wileyfox,default = overlay:com.cyngn.wileyfox,iconPack:com.cyngn.wileyfox,fontPkg:system,com.android.systemui = overlay:com .cyngn.wileyfox,com.android.systemui.navbar = overlay:com.cyngn.wileyfox} java.lang.RuntimeException:无法启动活动ComponentInfo {za.co.scsit.i_oncloud / com.commonsware.cwac.cam2.CameraActivity}:org.greenrobot.eventbus.EventBusException:订阅者类com.commonsware.cwac.cam2.CameraController它的超类没有@Subscribe注释的公共方法 在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2450) 在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510) 在android.app.ActivityThread.-wrap11(ActivityThread.java) 在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1363) 在android.os.Handler.dispatchMessage(Handler.java:102) 在android.os.Looper.loop(Looper.java:148) 在android.app.ActivityThread.main(ActivityThread.java:5461) at java.lang.reflect.Method.invoke(Native Method) 在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:726) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 引起:org.greenrobot.eventbus.EventBusException:订阅者类com.commonsware.cwac.cam2.CameraController及其超类没有@Subscribe注释的公共方法 at org.greenrobot.eventbus.SubscriberMethodFinder.findSubscriberMethods(SubscriberMethodFinder.java:67) 在org.greenrobot.eventbus.EventBus.register(EventBus.java:136) 在com.commonsware.cwac.cam2.CameraController.setEngine(CameraController.java:92) 在com.commonsware.cwac.cam2.AbstractCameraActivity.init(AbstractCameraActivity.java:401) 在com.commonsware.cwac.cam2.CameraActivity.init(CameraActivity.java:92) 在com.commonsware.cwac.cam2.AbstractCameraActivity.onCreate(AbstractCameraActivity.java:252) 在android.app.Activity.performCreate(Activity.java:6251) 在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403) 在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510) 在android.app.ActivityThread.-wrap11(ActivityThread.java) 在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1363) 在android.os.Handler.dispatchMessage(Handler.java:102) 在android.os.Looper.loop(Looper.java:148) 在android.app.ActivityThread.main(ActivityThread.java:5461) at java.lang.reflect.Method.invoke(Native Method) 在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:726) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
根据要求Build.Gradle:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
}
}
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId 'za.co.scsit.i_oncloud'
minSdkVersion 21
targetSdkVersion 25
versionCode 21
versionName "0.10.3"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.google.android.gms:play-services:10.0.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.amazonaws:aws-android-sdk-core:2.3.9'
compile 'com.amazonaws:aws-android-sdk-s3:2.3.9'
compile 'com.amazonaws:aws-android-sdk-ddb:2.3.9'
testCompile 'junit:junit:4.12'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.commonsware.cwac:cam2:0.7.5'
}
repositories {
maven {
url "https://s3.amazonaws.com/repo.commonsware.com"
}
mavenCentral()
}