android mainactivity 不能实例化,错误:com.google.android.gms.common.SignInButton无法实例化。...

作者分享了解决在Eclipse中导入既有项目遇到的R.java缺失及com.google.android.gms.common.SignInButton初始化错误的过程,包括解决步骤和尝试过的解决方案,如清理缓存和重启Eclipse。
摘要由CSDN通过智能技术生成

最初,试图通过Eclipse中的“将现有代码导入到Workspace”来打开现有代码项目导致了各种我无法弄清楚的错误。即R.java没有建造。我能够只创建一个空白的项目,然后复制并粘贴在所有代码和资源文件来解决这一点。

所以我的项目设置,和我所引用的google-play-services_lib和BaseGameUtils,所以有在MainActivity.java中没有错误出现,并且它将全部编译并构建好,但布局编辑器不断实例化com.google.android.gms.common.SignInButton。

我从下面的错误粘贴了完整的堆栈跟踪。我想不出任何我错过的东西,并且Eclipse中'Problems'窗口中唯一的事情是'应该明确地为清单设置android:allowBackup为true或false'。

android.content.res.Resources$NotFoundException: Could not resolve resource value: 0x7F02000C.

at android.content.res.BridgeResources.throwException(BridgeResources.java:693)

at android.content.res.BridgeResources.getDrawable(BridgeResources.java:164)

at com.google.android.gms.internal.aa.b(Unknown Source)

at com.google.android.gms.internal.aa.a(Unknown Source)

at com.google.android.gms.common.SignInButton.c(Unknown Source)

at com.google.android.gms.common.SignInButton.d(Unknown Source)

at com.google.android.gms.common.SignInButton.setStyle(Unknown Source)

at com.google.android.gms.common.SignInButton.(Unknown Source)

at com.google.android.gms.common.SignInButton.(Unknown Source)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:422)

at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:179)

at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)

at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135)

at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:746)

at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)

at android.view.LayoutInflater.rInflate(LayoutInflater.java:718)

at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:749)

at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)

at android.view.LayoutInflater.rInflate(LayoutInflater.java:718)

at android.view.LayoutInflater.inflate(LayoutInflater.java:489)

at android.view.LayoutInflater.inflate(LayoutInflater.java:372)

at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:385)

at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:332)

at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)

at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:440)

at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderPreview.renderSync(RenderPreview.java:560)

at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderPreview.access$5(RenderPreview.java:506)

at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderPreview$RenderJob.runInUIThread(RenderPreview.java:1230)

at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95)

at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)

at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)

at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4144)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)

at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)

at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)

at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)

at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)

at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)

at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)

at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)

at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)

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:629)

at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)

at org.eclipse.equinox.launcher.Main.run(Main.java:1438)

at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

2013-07-09

Fafhrd

+0

Wasx这解决了吗?我仍然有这个错误 –

+1

@Slartibartfast重新启动eclipse是解决方案。 –

+0

在Android Studio中,预览屏幕上的“清除缓存”工作。 –

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值