Android Studio 中的所有活动和布局都已损坏 [英] All Activities and layouts got corrupted in Android Studio

查看:30
本文介绍了Android Studio 中的所有活动和布局都已损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 3 个月开始就在做一个项目.今天,我的大部分活动和 xml 文件都已损坏.我曾尝试删除workspace.iml 文件,但它仍然相同.VCS 中的本地历史记录也是空的.有什么办法可以恢复我的代码或解决这个问题.注意如果我在记事本 app/scrc/main/activity.java 中打开这些文件,则这些文件与以前相同,但在 Android Studio 中显示不同

I am working on a projects since 3 months. Today most of my activities and xml files got corrupted. I have tried deleting workspace.iml file but it remains same.Local History in VCS is also empty. Is there any way to recover my code or solve this issue. Note These files are same as previous if I open then in Notepad app/scrc/main/activity.java, but showing different in Android studio

这是我的代码现在的样子

Here what my code looks like now

<component name="libraryTable">  <library name="Gradle: com.google.firebase:firebase-measurement-connector-impl-17.0.3">
<CLASSES>
  <root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/firebase-measurement-connector-impl-17.0.3.aar/fb2536827bf92d82ab72080a9863eb78/res" />
  <root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/firebase-measurement-connector-impl-17.0.3.aar/fb2536827bf92d82ab72080a9863eb78/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

gradle 文件:

apply plugin: 'com.android.application'apply plugin: 'com.google.gms.google-services'android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.apkfeast.class11walkthrogh"
    minSdkVersion 16
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'        }  }}dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.firebaseui:firebase-ui-database:4.2.1'
implementation 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.github.bumptech.glide:annotations:4.8.0'
implementation 'com.firebase:firebase-client-android:2.5.2'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
implementation 'com.android.support:multidex:1.0.3'}apply plugin: 'com.google.gms.google-services'

清单

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.apkfeast.class11walkthrogh"
android:screenOrientation="portrait" >

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

<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"
    android:fullBackupContent="true">
    <activity android:name=".Splash">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-3940256099942544~3347511713"/>

    <activity android:name=".Hyderabad" />
    <activity android:name=".Mirpurkhas" />
    <activity android:name=".SelectBoard" />
    <activity android:name=".Quiz" />
    <activity android:name=".Notes" />
    <activity android:name=".fedral" />
    <activity android:name=".sukkur" />
    <activity android:name=".larkana" />
    <activity android:name=".aghakhan" />
    <activity android:name=".sarghoda" />
    <activity android:name=".Rawalpindi" />
    <activity android:name=".Faisalabad" />
    <activity android:name=".Multan" />
    <activity android:name=".Gujranwala" />
    <activity android:name=".lahore" />
    <activity android:name=".karachi" />
    <activity android:name=".sahiwal" />
    <activity android:name=".dgkhan" />
    <activity android:name=".peshawar" />
    <activity android:name=".bahawalpur" />
    <activity android:name=".balochistan" />
    <activity android:name=".hydchem" />
    <activity android:name=".hydphy" />
    <activity android:name=".hydbio" />
    <activity android:name=".hydeng" />
    <activity android:name=".hydisl" />
    <activity android:name=".hydurd" />
    <activity android:name=".hydmat" />
    <activity android:name=".hydpak" />
    <activity android:name=".hydviewdown" />
    <activity android:name=".mpkVD" />
    <activity android:name=".fedVD" />
    <activity android:name=".sukVD" />
    <activity android:name=".larVD" />
    <activity android:name=".sarVD" />
    <activity android:name=".rawVD" />
    <activity android:name=".faiVD" />
    <activity android:name=".mulVD" />
    <activity android:name=".gujVD" />
    <activity android:name=".lahVD" />
    <activity android:name=".khiVD" />
    <activity android:name=".sahVD" />
    <activity android:name=".dgkVD" />
    <activity android:name=".pesVD" />
    <activity android:name=".bahVD" />
    <activity android:name=".balVD" />
    <activity android:name=".result" />
    <activity android:name=".bioquiz" />
    <activity android:name=".chemquiz" />
    <activity android:name=".phyquiz" />
    <activity android:name=".full" />
</application>

</manifest>


已解决

我已经通过删除 C:\Users\cc.AndroidStudio3.2\system\caches 中的所有文件来修复它.


Solved

I have fixed it by deleting all the files in C:\Users\cc.AndroidStudio3.2\system\caches.

推荐答案

今天早上我也遇到了同样的问题.我认为这是由于迁移到 AndroidX 但那是错的.它可能由于不正确的索引和构建而发生,例如索引是强制停止的.或由于某些 IDE 问题.

I also had the same problem this morning. I thought this was due to migrating to AndroidX but It was wrong. It may occur due to improper indexing and building for e.g. the indexing is force stopped. or due to some IDE issues.

问题通过删除项目中的gradle和.idea文件夹解决并通过 D:\Users\ABCD.AndroidStudio3.2\system\caches 清除 Android Studio IDE 的缓存.问题已解决.

注意:-请每天进行项目备份.

Note:- Please take Project Backups Daily.

这篇关于Android Studio 中的所有活动和布局都已损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆