Camera 360使用之坑

傲慢的上校發表於2015-11-11

有個朋友想使用Camera 360,過程中遇到了兩個坑,來找我尋求幫助。

第一個

Camera 360 需要在Manifest檔案裡面配置三個引數:

    <meta-data
        android:name="EDIT_SDK_KEY"
        android:value="hk5qVtkovqMu/jiSM+pHuVCwOkiDn5PppbAr7hb05Of9Jcd4+SXVsDetWTQUE9P1gtGmTkjzaWuOc12QnR87AOoMDfHFpdmuStZSh5+Rwp8IA/UVNtIq8T59hI7IWN6bMPGSurwTZC5OCSSpQq/UpV3Mz/L5ZWCJcxUUp3t3BSHRij1eXFwgZFbtZdxA/QQRaC6xMOUm5JMtMkXs2K3z/7bCjX0GvMWSSigBB3OI4MgNKomDIRCXTC/bQy1NnqoDuuYhpC+dv+LQ6R7iwFGxPAEJCY5rwKBT36GAboq64eF4HZeUboKBz5zdroNHE5YjYbczsIolLiWl+/RMG1rz58smTt4BQG0juhXwVWQAoEKigpKerHnH/5UcKJ09IPGPgGsE7Z+MIsmmTTHYwEEDepubw1H7MSp2zTOxGccsyOkqLZNGY+GzJxOzUyREIlXKzkhRozvc2TaBhkA3ZbGHJN13yi/wvgv4JOfXekIEQTOyy07MPfo/LKpypLK6yEhxWgSt1d7De7LmR6Vo//QmzoNrZnW0Q/x7mCnH26dZz0HeIZ7Mpd1S36LmW9P+iappC1pLeKSSxNpjP7qYVmQ/bvdX4zdyHX5Xihf2IIQQqQvqRyNOjmqA3hDfl8zLHQR4TLRqCoy8DhjedYiB9kOaHSYZMT46fc1lFknVs6sbRkCl10eXrZg/Ll9SDBOmRXUQ7xyXvKFYi6BtUFmD4HGuySnF3uHjX4lcbINMT/eOUqts4FfJZzlN9OvTEDNQT+AXoxvpcXRaw9bgjdlsaTtGg86r0msSrN8vNCH2x74uqcecjtVmxVelpcdMqQbH6ExI5SiciboJ8Wy76ZyhuyYFroA1sFXTAnW+pg0pB8amtDkTgMDkyFiRXePSpqzw6BIATmTJSYatUrLSheO9JrUalEH0yQiJ5/lEayN8InyV3D20cI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oGYtYDzqiJzc/q1oIOdOON5juis894KzKZx6ZgsupFE/laM9z38yYPrclJrpTlkK8WmL8C0L/WLGBGQOLAlIXkMR5gVuBLFhGnLqbCBkdd/DHfJ8SnV9LwCLnaqXak8rEj3yuon5HW0z7YkKgG1q7kJjxJmU+bdvFjGF/dEGP7YKn0c4p09oE3N5U6BpBlbwOp8QvUqi+MbhuOMmOm1CODtHMhQO+r6vu9arz5DxZgVMVx1PvnPEoWvyT5A2bmcY0id9/Ybx5XKY0VBDtrCPAz7naE3n11mWkd8aPL2HQwFbvkDcKI/zBvKXdV0nGHcghQ92v+kF8bdBJP7se5kYXmnLwBhch5qxUKmbPBF2/A=="/>

    <meta-data android:name="BD_APP_ID"
        android:value="ea8d04692735bc1f"/>

    <meta-data
        android:name="BD_APP_SECRET"
        android:value="vCGG9QZ94tcGxTjangCc_b_VuXwmfGd2"/>

但在其網站後臺,你只能找到一個可以,這個key值對應於EDIT_SDK_KEY,而BD_APP_ID,BD_APP_SECRET這兩個值,竟然是直接原樣拷貝文件即可。

第二

在其跳轉時

PGEditSDK.instance().startEdit(getActivity(), PGEditActivity.class, mOriginalPicPath, mFinalPicPath);

注意你的Activity在manifest裡面的 style型別

原來程式碼裡他的Activity style 是

android:theme="@style/AlertDialog.AppCompat"

導致 Camera 360 Dialog載入失敗,
換成和其Demo裡面一樣的 style 即可

"@android:style/Theme.Black.NoTitleBar.Fullscreen"

其中,報錯內容大概如下

android.view.InflateException: Binary XML file line #30: Error inflating class <unknown>
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     Caused by: android.view.InflateException: Binary XML file line #30: Error inflating class <unknown>
            at android.view.LayoutInflater.createView(LayoutInflater.java:633)
            at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.onCreateView(CalligraphyLayoutInflater.java:164)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
            at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.onCreateView(CalligraphyLayoutInflater.java:148)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:504)

Android 因為style引發的問題還是挺多的,需要注意了。

相關文章