我知道这个问题已经被问过多次了,但是我仍然无法解决问题。我尝试通过xml资源将横幅广告添加到我的应用中,但是当我从xml视图切换到图形布局或清理我的项目时,我收到以下消息:“ com.google.android.gms.ads.AdView未能实例化


  java.lang.VerifyError:期望分支目标77处有堆栈映射框架。”


有时会说分支目标是57。

我正在使用googleplayservices SDK版本18。
我尝试使用Java jdk 7u51和当前的8u5。
eclipse版本为kepler,目前为luna。
我已经在Java 1.5、1.6和1.7上进行了编译。


我尝试将adMob.jar文件添加到构建路径。我已经按照Google的所有指示(以及在该网站上可以找到的所有变体)对这封信进行了说明,但还是没有。我尝试将已安装的JRE中默认虚拟机的参数参数更改为-XX:-UseSplitVerifier
我尝试将googleplayservices lib文件夹直接添加到构建路径,并添加一个libs文件夹,然后将其放在其中。
我已经更改了订单并导出,因此googleplayservices位于我的构建路径的顶部。我尝试将googleplayservices添加为源文件夹。
最后,我分别尝试了这些选项中的每个选项,并尝试了它们的不同组合。


我已经编写了一年多的代码,这是我第一次无法在此站点上获得有效的答案。

这是放置横幅广告的xml文件:

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 xmlns:ads="http://schemas.android.com/apk/res-auto"
 android:layout_width="match_parent"
 android:layout_height="fill_parent"
 android:orientation="vertical">

    <com.google.android.gms.ads.AdView android:id="@+id/adView"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     ads:adUnitId="I used my real ad unit id her"
                     ads:adSize="BANNER"/>

    <rest of my layout here/>

   </LinearLayout>


这是我的清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my package name"
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>



<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:debuggable="true" android:hardwareAccelerated="true">
    <meta-data android:name="com.google.android.gms.version"
           android:value="@integer/google_play_services_version"/>
    <activity
        android:name="my main activity"
        android:label="@string/app_name" android:configChanges="orientation" android:theme="@android:style/Theme.Black.NoTitleBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="com.google.android.gms.ads.AdActivity"
         android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
    <activity android:name=".SettingsActivity" android:configChanges="orientation" android:theme="@android:style/Theme.Black.NoTitleBar"></activity>
    <activity android:name=".HelpActivity" android:theme="@android:style/Theme.Black.NoTitleBar" android:configChanges="orientation"></activity>
    <activity android:name=".SetTimeActivity" android:theme="@android:style/Theme.Dialog" android:configChanges="orientation"></activity>
</application>




这是错误日志中的事件详细信息:

com.google.android.gms.ads.AdView failed to instantiate.

  java.lang.VerifyError: Expecting a stackmap frame at branch target 77
Exception Details:
Location:
  com/google/android/gms/ads/AdView.onLayout(ZIIII)V @9: ifnull
Reason:
Expected stackmap frame at this location.
Bytecode:
0000000: 2a03 b600 153a 0619 06c6 0044 1906 b600
0000010: 0b10 089f 003a 1906 b600 0a36 0719 06b6
0000020: 0009 3608 1504 1c64 1507 6405 6c36 0915
0000030: 051d 6415 0864 056c 360a 1906 1509 150a
0000040: 1509 1507 6015 0a15 0860 b600 0cb1

at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:363)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:190)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:373)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:399)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:336)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:332)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:517)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1584)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1309)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.changed(GraphicalEditorPart.java:725)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.onTargetChange(GraphicalEditorPart.java:1196)
at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.onDescriptorsChanged(LayoutEditorDelegate.java:916)
at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegateInitUiRootNode(LayoutEditorDelegate.java:835)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart$TargetListener.updateEditor(GraphicalEditorPart.java:953)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart$TargetListener.onTargetLoaded(GraphicalEditorPart.java:917)
at com.android.ide.eclipse.adt.AdtPlugin$11.run(AdtPlugin.java:1749)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:236)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)


而我的版本和构建信息:

eclipse.buildId=4.4.0.I20140606-1215
java.version=1.8.0_05
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.standard.product
Command-line arguments:  -data C:\Users\"user name"\Desktop\"my" workspace -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.standard.product


编辑:我决定在一个新的工作区中创建一个新的android应用程序项目,并向其中添加横幅广告,但是它也给了我与上述相同的错误。

最佳答案

为此打开了一个问题76114,其中包含针对Android Studio的解决方法:
https://code.google.com/p/android/issues/detail?id=76114

要解决Eclipse SDK,请执行以下操作:


编辑SDK_HOME \ eclipse \ eclipse.ini
添加新行:
    -XX:-UseSplitVerifier
重新开始蚀。

07-28 13:18