0

我正在使用android studio,經過2天的搜索,我無法解決這個問題,我想使用AdView到我的項目中,我嘗試了很多東西,但我仍然在設計時在android studio上有這個錯誤 。呈現問題com.google.android.gms.ads.AdView

對於當下的build.gradle文件中有

的Android { compileSdkVersion 21 buildToolsVersion 「21.1.2」 ....}

依賴{ 編譯文件樹(導演:'庫,包括:[ '的* .jar']) 編譯 'com.google.android.gms:發揮服務的廣告:87年6月5日' }

java.lang.ClassNotFoundException: com.google.android.gms.internal.cy$a 
    at com.android.tools.idea.rendering.RenderClassLoader.findClass(RenderClassLoader.java:53) 
    at org.jetbrains.android.uipreview.ProjectClassLoader.findClass(ProjectClassLoader.java:56) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248) 
    at java.lang.ClassLoader.defineClass1(Native Method) 
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) 
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616) 
    at java.lang.ClassLoader.defineClass(ClassLoader.java:466) 
    at com.android.tools.idea.rendering.RenderClassLoader.loadClassFromJar(RenderClassLoader.java:93) 
    at org.jetbrains.android.uipreview.ProjectClassLoader.loadClassFromModuleOrDependency(ProjectClassLoader.java:108) 
    at org.jetbrains.android.uipreview.ProjectClassLoader.load(ProjectClassLoader.java:89) 
    at com.android.tools.idea.rendering.RenderClassLoader.findClass(RenderClassLoader.java:56) 
    at org.jetbrains.android.uipreview.ProjectClassLoader.findClass(ProjectClassLoader.java:56) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248) 
    at com.google.android.gms.internal.bh.<init>(Unknown Source) 
    at com.google.android.gms.internal.bh.<init>(Unknown Source) 
    at com.google.android.gms.internal.bh.<init>(Unknown Source) 
    at com.google.android.gms.ads.AdView.<init>(Unknown Source) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513) 
    at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:374) 
    at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:99) 
    at com.android.tools.idea.rendering.LayoutlibCallback.loadView(LayoutlibCallback.java:172) 
    at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207) 
    at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:132) 
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806) 
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:782) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:385) 
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:400) 
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:332) 
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:332) 
    at com.android.tools.idea.rendering.RenderService$3.compute(RenderService.java:575) 
    at com.android.tools.idea.rendering.RenderService$3.compute(RenderService.java:564) 
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932) 
    at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:564) 
    at com.android.tools.idea.rendering.RenderService.render(RenderService.java:691) 
    at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$6.run(AndroidDesignerEditorPanel.java:483) 
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320) 
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310) 
    at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254) 
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269) 
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227) 
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217) 
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238) 
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:327) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
    at java.lang.Thread.run(Thread.java:662) 

預先感謝

+2

您是否嘗試安裝最新版本的android SDK構建工具?此外,從編譯器合規性級別1.6切換到1.7。我發現這個堆棧溢出票。我希望它會幫助你:http://stackoverflow.com/questions/24930782/classnotfoundexception-didnt-find-class-com-google-android-gms-ads-adview –

+0

是的,我幾乎更新了任何東西:)但沒有任何作品。我已1.6並改爲1.8,當我試圖安裝1.7我不能這樣做,因爲我第一次更新到1.8。但我得到同樣的錯誤。我也嘗試了MultiDex,但沒有奏效。 – Dimitrios

回答

0

87年6月5日是一個非常老版本的移動廣告SDK的。我相信8.4.0是當前版本;試一試。