iyotetsuya / RectangleDetection

Using OpenCV 2411 and RxJava implement a rectangle detection Android App
MIT License
38 stars 13 forks source link

Refactor current code to modern architecture #2

Open iyotetsuya opened 8 years ago

iyotetsuya commented 8 years ago

ref: https://github.com/android10/Android-CleanArchitecture https://developer.android.com/jetpack/docs/guide#common-principles this project is not big, will consider using MVVM to make it simple.

Harmeet2491 commented 8 years ago

Hi there I tried running the code but I ran into this error: Error inflating class io.github.iyotetsuya.rectangledetection.views.CameraPreview, Can you assist me on this? Regards

iyotetsuya commented 8 years ago

Sure, can you post whole stacktrace for the exception?

Harmeet2491 commented 8 years ago

Yes sure, Here it is: FATAL EXCEPTION: Process: io.github.iyotetsuya.rectangledetection, PID: 29050 java.lang.RuntimeException: Unable to start activity ComponentInfo{io.github.iyotetsuya.rectangledetection/io.github.iyotetsuya.rectangledetection.MainActivity}: android.view.InflateException: Binary XML file line #7: Binary XML file line #7: Error inflating class io.github.iyotetsuya.rectangledetection.views.CameraPreview at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2434) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494) at android.app.ActivityThread.access$900(ActivityThread.java:157) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5551) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) Caused by: android.view.InflateException: Binary XML file line #7: Binary XML file line #7: Error inflating class io.github.iyotetsuya.rectangledetection.views.CameraPreview at android.view.LayoutInflater.inflate(LayoutInflater.java:539) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:409) at android.app.Activity.setContentView(Activity.java:2171) at io.github.iyotetsuya.rectangledetection.MainActivity.onCreate(MainActivity.java:33) at android.app.Activity.performCreate(Activity.java:6272) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)  at android.app.ActivityThread.access$900(ActivityThread.java:157)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5551)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)  Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class io.github.iyotetsuya.rectangledetection.views.CameraPreview at android.view.LayoutInflater.createView(LayoutInflater.java:645) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:409)  at android.app.Activity.setContentView(Activity.java:2171)  at io.github.iyotetsuya.rectangledetection.MainActivity.onCreate(MainActivity.java:33)  at android.app.Activity.performCreate(Activity.java:6272)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)  at android.app.ActivityThread.access$900(ActivityThread.java:157)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5551)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)  Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance(Native Method) at android.view.LayoutInflater.createView(LayoutInflater.java:619) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:409)  at android.app.Activity.setContentView(Activity.java:2171)  at io.github.iyotetsuya.rectangledetection.MainActivity.onCreate(MainActivity.java:33)  at android.app.Activity.performCreate(Activity.java:6272)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)  at android.app.ActivityThread.access$900(ActivityThread.java:157)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5551)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)  Caused by: java.lang.RuntimeException: Fail to connect to camera service at android.hardware.Camera.(Camera.java:549) at android.hardware.Camera.open(Camera.java:361) at io.github.iyotetsuya.rectangledetection.views.CameraPreview.(CameraPreview.java:68) at java.lang.reflect.Constructor.newInstance(Native Method)  at android.view.LayoutInflater.createView(LayoutInflater.java:619)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:409)  at android.app.Activity.setContentView(Activity.java:2171)  at io.github.iyotetsuya.rectangledetection.MainActivity.onCreate(MainActivity.java:33)  at android.app.Activity.performCreate(Activity.java:6272)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)  at android.app.ActivityThread.access$900(ActivityThread.java:157)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5551)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) 

iyotetsuya commented 8 years ago

Please discuss this issue here #3