简体   繁体   English

将外部jar添加到android项目

[英]Adding external jars to android project

So I just recently updated to ADT 20 and it's been a complete nightmare. 所以我最近才更新到ADT 20,这真是一场噩梦。

I tried all the solutions I've found online. 我尝试了所有在网上找到的解决方案。 1. I put the jar into the LIBS folder 2. Added jar from libary tab in the build path & checked it in the export path 3. I even did this one thing where someone said to make the libs folder a source folder (i guess so it get exported) 1.我将jar放入LIBS文件夹中。2.在构建路径的libary选项卡中添加了jar,并在导出路径中对其进行了检查。3.我什至做了这件事,有人说要使libs文件夹成为源文件夹(我猜是所以它被导出)

Nothing works. 什么都没有。 Please help this is a total nightmare. 请帮助,这完全是一场噩梦。 I can't use any external jars at all... 我根本不能使用任何外部罐子...

08-18 11:06:45.144: E/AndroidRuntime(3886): FATAL EXCEPTION: main
08-18 11:06:45.144: E/AndroidRuntime(3886): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.test/com.example.test.Main}: android.view.InflateException: Binary XML file line #15: Error inflating class com.google.ads.AdView
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1696)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1716)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.app.ActivityThread.access$1500(ActivityThread.java:124)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:968)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.os.Looper.loop(Looper.java:130)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.app.ActivityThread.main(ActivityThread.java:3806)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at java.lang.reflect.Method.invokeNative(Native Method)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at java.lang.reflect.Method.invoke(Method.java:507)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at dalvik.system.NativeStart.main(Native Method)
08-18 11:06:45.144: E/AndroidRuntime(3886): Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class com.google.ads.AdView
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.view.LayoutInflater.createView(LayoutInflater.java:518)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.app.Activity.setContentView(Activity.java:1703)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at com.example.test.Main.onCreate(Main.java:12)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1660)
08-18 11:06:45.144: E/AndroidRuntime(3886):     ... 11 more
08-18 11:06:45.144: E/AndroidRuntime(3886): Caused by: java.lang.reflect.InvocationTargetException
08-18 11:06:45.144: E/AndroidRuntime(3886):     at java.lang.reflect.Constructor.constructNative(Native Method)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at android.view.LayoutInflater.createView(LayoutInflater.java:505)
08-18 11:06:45.144: E/AndroidRuntime(3886):     ... 21 more
08-18 11:06:45.144: E/AndroidRuntime(3886): Caused by: java.lang.RuntimeException: Could not initialize AdView: Required XML attribute "adUnitId" missing
08-18 11:06:45.144: E/AndroidRuntime(3886):     at com.google.ads.AdView.a(SourceFile:417)
08-18 11:06:45.144: E/AndroidRuntime(3886):     at com.google.ads.AdView.<init>(SourceFile:129)
08-18 11:06:45.144: E/AndroidRuntime(3886):     ... 24 more
08-18 11:06:45.144: E/AndroidRuntime(3886): Caused by: com.google.ads.internal.b: Required XML attribute "adUnitId" missing
08-18 11:06:45.144: E/AndroidRuntime(3886):     at com.google.ads.AdView.a(SourceFile:360)
08-18 11:06:45.144: E/AndroidRuntime(3886):     ... 25 more

I actually figure out what was wrong right when I posted this. 当我发布此消息时,我实际上发现了什么地方不对。 Caused by: com.google.ads.internal.b: Required XML attribute "adUnitId" missing . Caused by: com.google.ads.internal.b: Required XML attribute "adUnitId" missing So stupid, the error logs put it all the way at the bottom. 如此愚蠢,错误日志将其放在底部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM