android主题未找到异常

时间:2014-02-17 19:29:22

标签: android

我在Android上有一个与android 2.3一起工作的项目。现在我将它迁移到android API级别16.我删除了支持库,更改了引用。但我对这个主题有疑问。 Eclipse已经显示出一些错误,我无法解决它们。

eclipse.buildId=4.3.0.M20130911-1000
java.version=1.7.0_45
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=es_VE
Framework arguments:  -product org.eclipse.epp.package.standard.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.standard.product

Error
Mon Feb 17 13:01:05 VET 2014
activity_photo.xml: android.content.res.Resources$NotFoundException

android.content.res.Resources$NotFoundException
    at com.android.layoutlib.bridge.android.BridgeContext.obtainStyledAttributes(BridgeContext.java:468)
    at android.content.res.Resources_Theme_Delegate.obtainStyledAttributes(Resources_Theme_Delegate.java:48)
    at android.content.res.Resources$Theme.obtainStyledAttributes(Resources.java:1279)
    at android.widget.TextView.<init>(TextView.java:666)
    at android.widget.TextView.<init>(TextView.java:617)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at android.view.LayoutInflater.createView(LayoutInflater.java:594)
    at android.view.BridgeInflater.onCreateView(BridgeInflater.java:86)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
    at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:131)
    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 com.android.layoutlib.bridge.android.BridgeContext.inflateView(BridgeContext.java:372)
    at com.android.layoutlib.bridge.impl.binding.AdapterHelper.getView(AdapterHelper.java:49)
    at com.android.layoutlib.bridge.impl.binding.FakeAdapter.getView(FakeAdapter.java:114)
    at android.widget.AbsSpinner.onMeasure(AbsSpinner.java:193)
    at android.widget.Spinner.onMeasure(Spinner.java:482)
    at android.view.View.measure(View.java:16458)
    at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
    at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
    at android.view.View.measure(View.java:16458)
    at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1226)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
    at android.widget.ScrollView.onMeasure(ScrollView.java:326)
    at android.view.View.measure(View.java:16458)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
    at android.view.View.measure(View.java:16458)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView(RenderSessionImpl.java:621)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:490)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:338)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:334)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:451)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1545)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1302)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.changed(GraphicalEditorPart.java:718)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.onTargetChange(GraphicalEditorPart.java:1189)
    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:946)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart$TargetListener.onTargetLoaded(GraphicalEditorPart.java:910)
    at com.android.ide.eclipse.adt.AdtPlugin$11.run(AdtPlugin.java:1759)
    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:3717)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3366)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    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:354)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1426)

Error
Mon Feb 17 13:01:05 VET 2014
activity_photo.xml: Failed to find style 'buttonStyle' in current theme

这是AndroidManifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.brightcomms.vector"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="19" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />
    <uses-feature
        android:name="android.hardware.camera"
        android:required="true" />

    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Holo.Light.DarkActionBar" >
<activity
            android:name="com.brightcomms.vector.HomeActivity"
            android:label="@string/app_name" >
            <meta-data
                android:name="android.app.searchable"
                android:resource="@xml/seachable" />

            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.brightcomms.vector.LoginActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyA5pGYaMwJ4oTAzht3mimzSAVyhOAMNA-4" />
        <!-- PRO: AIzaSyA5pGYaMwJ4oTAzht3mimzSAVyhOAMNA-4 -->
        <!-- DEV: AIzaSyDLGbX1YOapmuPt-UNkn_5CD5Q70J9KLMY -->
        <activity
            android:name="com.brightcomms.vector.SiteActivity"
            android:label="@string/title_activity_site"
            android:parentActivityName="com.brightcomms.vector.HomeActivity" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.brightcomms.vector.HomeActivity" />
            <meta-data
                android:name="com.google.android.gms.version"
                android:value="@integer/google_play_services_version" />
        </activity>
        <activity
            android:name="com.brightcomms.vector.PhotoActivity"
            android:label="@string/title_activity_photo"
            android:parentActivityName="com.brightcomms.vector.SiteActivity" 
            android:configChanges="orientation|screenSize|keyboardHidden"
            >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.brightcomms.vector.SiteActivity" />
        </activity>
    </application>

</manifest>

布局:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="fill_parent">
<RelativeLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".PhotoActivity" >

    <EditText
        android:id="@+id/name_photo"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="@string/name_photo" />
<Spinner
        android:id="@+id/sectorselector"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@id/name_photo"
        android:layout_marginTop="10dp" />
    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="fill_parent"
        android:layout_height="190dp"
        android:layout_below="@+id/sectorselector"
        android:layout_marginTop="10dp"
        android:src="@android:drawable/btn_plus" />

    <Button
        android:id="@+id/take_photo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/imageView1"
        android:layout_alignLeft="@+id/imageView1"
        android:layout_marginTop="10dp"
        android:text="@string/take_photo" />

    <Button
        android:id="@+id/sendform"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/take_photo"
        android:layout_marginTop="19dp"
        android:text="@string/send" />

</RelativeLayout>
</ScrollView>

1 个答案:

答案 0 :(得分:0)

查看崩溃的布局(activity_photo)并确保其主题设置为适当的SDK级别。