gpt4 book ai didi

java - 在 Android Studio 中未找到 BaseGameUtilities 源

转载 作者:太空宇宙 更新时间:2023-11-04 14:40:01 24 4
gpt4 key购买 nike

我已经尝试安装 Google Play 服务 好几个小时了,但在尝试到处搜索后,我似乎找不到问题的解决方案。我想我已经导入了 BaseGameUtilsPlayGamesServices,并且 Android Studio 现在会在我的应用程序中自动识别这些,对我来说,它们就像已实现。

但是当我尝试添加登录按钮时

<com.google.android.gms.common.SignInButton
android:id="@+id/bHighScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/button1"
android:layout_alignBottom="@+id/button1"
android:layout_marginLeft="98dp"
android:layout_toRightOf="@+id/button1"
android:text="Highscore"
/>

它说

The following classes could not be instantiated:
- com.google.android.gms.common.SignInButton (Open Class, Show Exception)
java.lang.VerifyError: Expecting a stackmap frame at branch target 13

异常详细信息: 地点: com/google/android/gms/common/SignInButton.setStyle(II)V @1:iflt 原因: 预期堆栈图帧位于此位置。

Bytecode:

0000000: 1b9b 000c 1b06 a200 0704 a700 0403 1206
0000010: 04bd 0014 5903 1bb8 002c 53b8 0028 1c9b
0000020: 000c 1c05 a200 0704 a700 0403 1207 04bd
0000030: 0014 5903 1cb8 002c 53b8 0028 2a1b b500
0000040: 182a 1cb5 0015 2a2a b600 23b7 0027 b1

at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2658)
at java.lang.Class.getConstructor0(Class.java:2964)
at java.lang.Class.getConstructor(Class.java:1812)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:310)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:100)
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:802)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:778)
at android.view.LayoutInflater.inflate(LayoutInflater.java:500)
at android.view.LayoutInflater.inflate(LayoutInflater.java:381)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:400)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:329)
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 org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:586)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1900(AndroidLayoutPreviewToolWindowManager.java:80)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$6$1.run(AndroidLayoutPreviewToolWindowManager.java:528)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$6.run(AndroidLayoutPreviewToolWindowManager.java:523)
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:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

当我打开类(class)时,它说找不到源,我不知道要在附加源中放入什么。

任何帮助将不胜感激。

最佳答案

I had this same issue ,以及编译问题。

如果您尝试编译为 java 8 jdk 字节码,那么问题实际上出在 android 本身 - Android 最多只支持讨论的 java 7 jdk here 。但是,正如该文章中提到的,您可以尝试使用 retro-lambda ,它通过我不明白的 voodoo 将 java 8 字节码转换回 java 7。

这并不意味着你不能使用 jdk 1.8,你只需编译为 java 7 字节码,因此本身就不能使用 java 8 语法糖。

要在您的移动 build.gradle 中修复此问题(这是我的)

apply plugin: 'com.android.application'

android {
compileSdkVersion 'android-L'
buildToolsVersion '20.0.0'

defaultConfig {
applicationId "com.example"
minSdkVersion 17
targetSdkVersion 'L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
apply plugin: 'findbugs'
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
compile 'com.google.android.gms:play-services:5.0.89'
}

将编译选项更改为:

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}

关于java - 在 Android Studio 中未找到 BaseGameUtilities 源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25058517/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com