我一直在尝试安装Google Play Services
几个小时,但在尝试搜索到处后,我似乎找不到解决问题的方法。我想我已导入了BaseGameUtils
和PlayGamesServices
,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 原因: 此位置的预期堆栈图帧。
字节码:
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)
当我打开课程时,它说Sources没有找到,我不知道在附加的资源中放什么。
非常感谢任何帮助。
答案 0 :(得分:0)
I had this same issue,以及编译问题。
如果你试图编译成java 8 jdk字节码,那么问题实际上是在android本身 - Android只支持java 7 jdk讨论here。但是,正如那篇文章中提到的那样,你可以尝试使用retro-lambda,通过伏都教,我不会理解将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
}
}