gpt4 book ai didi

java - Android Studio : Cannot resolve symbol 'activity'

转载 作者:行者123 更新时间:2023-12-02 04:11:52 27 4
gpt4 key购买 nike

在 Android Studio 中,我收到错误“无法解析符号‘activity’。

我查看了其他问题并尝试了以下方法

  • 使缓存无效/重新启动
  • 将“粘贴时插入导入”设置为全部,选中“动态优化导入”并选中“动态添加明确的导入”

这些都不起作用。

如有任何帮助,我们将不胜感激。

这是我的 AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thesgn.app"
android:installLocation="auto">

<!-- versionCode, versionName, minSdkVersion, targetSdkVersion properties are set via Gradle script -->

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature" android:name="com.thesgn.app.permission.C2D_MESSAGE" />
<uses-permission android:name="com.thesgn.app.permission.C2D_MESSAGE" />

<application
android:name=".WebViewAppApplication"
android:icon="@drawable/ic_launcher"
android:label="TheSGN"
android:theme="@style/Theme.WebViewApp.Orange"
android:hardwareAccelerated="true"
android:allowBackup="true">

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<meta-data android:name="com.google.android.gms.analytics.globalConfigResource" android:resource="@xml/analytics_global_tracker" />

<activity
android:name=".activity.MainActivity"
android:label="@string/app_name"
android:launchMode="standard"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode|smallestScreenSize" />

<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver
android:name="com.parse.ParsePushBroadcastReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<receiver
android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.thesgn.app" />
</intent-filter>
</receiver>
<meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/ic_stat_notify" />

</application>

最佳答案

.activity 将是您的 MainActivity 所在包的名称。您只需相应地调整 android:name 标签即可您的应用程序的层次结构。如果它位于顶部,则为 .MainActivity,否则为 .somePackageName.MainActivity

关于java - Android Studio : Cannot resolve symbol 'activity' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33712962/

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