簡體   English   中英

Android studio意圖錯誤

[英]Android studio intent error

應用程序名稱:envi

主要活動調用screen1.javascreen1.java使用Intent調用screen2 我收到以下錯誤:

Error:(24, 36) No resource found that matches the given name (at 'label' with value '@string/envi').
Error:(37, 36) No resource found that matches the given name (at 'label' with value '@string/envi').

這就是我的androidmanifest.xml的樣子

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.kriti.envi"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="15"
    android:targetSdkVersion="15" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.kriti.envi.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <activity
                android:name="com.example.kriti.envi.screen1"
                android:label="@string/envi" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.example.kriti.envi.actvityscreen2"
        android:label="@string/title_activity_actvityscreen2" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <activity
                android:name="com.example.kriti.envi.screen2"
                android:label="@string/envi" />

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

該問題可能是由於缺少帶有密鑰envi字符串資源引起的。

但那里還有其他問題。 你的AndroidManifest.xml錯了。

標記<intent-filter>不能包含標記<activity> ,請參閱此處的文檔。

它只能包含<action><category><data>標簽。 標簽<activity>只能放在標簽<application> 因此,您的應用程序不知道名稱為com.example.kriti.envi.screen1com.example.kriti.envi.screen2任何活動。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM