android - Android Studio-重新打开项目后出现很多错误

标签 android compiler-errors

我一直在开发昨天发布到Play商店的应用程序,但是今天早上重新打开它进行更改时,AndroidManifest.xmlactivity_main.xmlstyles.xml文件中存在很多错误。

编辑:这是文件和错误

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

<WebView
    android:id="@+id/the_wv"
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>

错误:
  • 第2、3和4行:未注册URI
  • 第5、6和7行:此处不允许使用attribute:xxxx
  • 第9行:此处不允许使用元素WebView

  • styles.xml
    <resources>
    
        <!-- Base application theme. -->
        <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
            <!-- Customize your theme here. -->
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorAccent">@color/colorAccent</item>
            <item name="android:statusBarColor">@color/mainColor</item>
        </style>
    
    </resources>
    

    错误:
  • 第6-9行:无法解析符号“xxxxxx”

  • AndroidManifest.xml
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.appname">
    
        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
            <activity
                android:screenOrientation="portrait"
                android:name=".MainActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    
    </manifest>
    

    错误:
  • 第2行:未注册URI
  • 第6、7、9、10、11和13行:此处不允许使用xxxxxx属性
  • 第14行:未解析的类'MainActivity'

  • 有什么想法为什么会突然抛出所有这些错误?

    最佳答案

    您可以尝试使Android Studio缓存无效。

    文件->使高速缓存无效/重新启动->使无效并重新启动

    关于android - Android Studio-重新打开项目后出现很多错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55059730/

    相关文章:

    android - 奇怪的 View.getHitRect() 行为

    android - webview 没有关闭 onclosewindow

    objective-c - NSString “Expected ' :' before ' ]' token”错误

    c++ - 首先定义 Here c++ error by adding one file

    compiler-errors - swift "Ambiguous use of operator ' = ='"

    java - Android:从模型类访问 R.string

    android - Firebase 上的 Facebook 登录正在注册但身份验证不起作用

    php - 在android中使用Base64

    ubuntu - Caffe 安装 - 无法开始编译

    android - 错误 : EPERM: operation not permitted