3

现在我正在使用Pinint Android SDK下载它并与我的项目集成,但是当我尝试注册客户端时遇到问题,这个特定的 url 有一个错误并且不允许我创建客户端 ID。我在项目中添加了 jar 文件,但是当我运行项目时仍然无法正常工作,它会因以下原因而崩溃

06-26 17:31:11.173: E/AndroidRuntime(23743): FATAL EXCEPTION: main
06-26 17:31:11.173: E/AndroidRuntime(23743): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.putitout.GREEGS/com.putitout.GREEGS.Menu.ProductDetail}: android.view.InflateException: Binary XML file line #358: Error inflating class com.pinterest.external.PinItButton
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2071)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.app.ActivityThread.access$600(ActivityThread.java:138)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.os.Looper.loop(Looper.java:213)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.app.ActivityThread.main(ActivityThread.java:4787)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at java.lang.reflect.Method.invokeNative(Native Method)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at java.lang.reflect.Method.invoke(Method.java:511)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at dalvik.system.NativeStart.main(Native Method)
06-26 17:31:11.173: E/AndroidRuntime(23743): Caused by: android.view.InflateException: Binary XML file line #358: Error inflating class com.pinterest.external.PinItButton
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:262)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.app.Activity.setContentView(Activity.java:1867)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at com.putitout.GREEGS.Menu.ProductDetail.onCreate(ProductDetail.java:82)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.app.Activity.performCreate(Activity.java:5008)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
06-26 17:31:11.173: E/AndroidRuntime(23743):    ... 11 more
06-26 17:31:11.173: E/AndroidRuntime(23743): Caused by: java.lang.ClassNotFoundException: com.pinterest.external.PinItButton
06-26 17:31:11.173: E/AndroidRuntime(23743):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.view.LayoutInflater.createView(LayoutInflater.java:552)
06-26 17:31:11.173: E/AndroidRuntime(23743):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
06-26 17:31:11.173: E/AndroidRuntime(23743):    ... 23 more

需要这方面的帮助 谢谢

4

2 回答 2

2

从日志中可以清楚地看出,在扩展小部件 Pinit 按钮时会导致异常。我刚刚使用我的档案管理器打开了 jar 文件,发现“PinItButton”不在路径中

<com.pinterest.external.PinItButton 

如 sdk 中所述。

实际路径是

<com.pinterest.pinit.PinItButton 

将上述路径替换为 XML 中的 Pinit 按钮,问题将得到解决。

于 2013-09-25T08:31:55.083 回答
1

为了解决这个问题,请删除按钮代码,而不是使用Xml创建按钮Java。那么这个问题就迎刃而解了。

例如

    RelativeLayout view = (RelativeLayout) findViewById(R.id.v);    
    PinItButton pinIt = new PinItButton(this);
    view.addView(pinIt);
于 2013-07-06T13:35:34.070 回答