更新android studio时的问题

时间:2018-02-10 18:54:01

标签: android-studio gradle android-gradle xml-editor

我已经从android studio 2.3.3更新到android studio 3.0.1,我遇到了几个问题: 1. xml预览不起作用,它只是停留在加载屏幕上(等待构建完成......) 2.代码完成无效,但仅在xml文件中。

还有这个令人遗憾的致命错误:

Resource name cannot be empty.
java.lang.IllegalArgumentException: Resource name cannot be empty.
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
    at com.android.ide.common.res2.ResourceItem.<init>(ResourceItem.java:115)
    at com.android.ide.common.res2.IdGeneratingResourceParser$IdResourceItem.<init>(IdGeneratingResourceParser.java:202)
    at com.android.ide.common.res2.IdGeneratingResourceParser.<init>(IdGeneratingResourceParser.java:81)
    at com.android.ide.common.res2.ResourceSet.createResourceFile(ResourceSet.java:456)
    at com.android.ide.common.res2.ResourceSet.createFileAndItems(ResourceSet.java:111)
    at com.android.ide.common.res2.ResourceSet.handleNewFile(ResourceSet.java:257)
    at com.android.ide.common.res2.ResourceSet.handleNewFile(ResourceSet.java:52)
    at com.android.ide.common.res2.DataSet.loadFile(DataSet.java:275)
    at com.android.tools.idea.res.ResourceFolderRepository$InitialScanState.loadFile(ResourceFolderRepository.java:325)
    at com.android.tools.idea.res.ResourceFolderRepository.scanFileResourceFile(ResourceFolderRepository.java:524)
    at com.android.tools.idea.res.ResourceFolderRepository.scanFileResourceFolder(ResourceFolderRepository.java:477)
    at com.android.tools.idea.res.ResourceFolderRepository.scanResFolder(ResourceFolderRepository.java:449)
    at com.android.tools.idea.res.ResourceFolderRepository.scanRemainingFiles(ResourceFolderRepository.java:375)
    at com.android.tools.idea.res.ResourceFolderRepository.<init>(ResourceFolderRepository.java:119)
    at com.android.tools.idea.res.ResourceFolderRepository.create(ResourceFolderRepository.java:152)
    at com.android.tools.idea.res.ResourceFolderRegistry.get(ResourceFolderRegistry.java:76)
    at com.android.tools.idea.res.ResourceFolderRegistry.get(ResourceFolderRegistry.java:64)
    at com.android.tools.idea.res.ModuleResourceRepository.create(ModuleResourceRepository.java:95)
    at com.android.tools.idea.res.ResourceRepositories.lambda$getModuleResources$2(ResourceRepositories.java:98)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
    at com.android.tools.idea.res.ResourceRepositories.getModuleResources(ResourceRepositories.java:95)
    at com.android.tools.idea.res.ModuleResourceRepository.findModuleResources(ModuleResourceRepository.java:71)
    at com.android.tools.idea.res.ModuleResourceRepository.getOrCreateInstance(ModuleResourceRepository.java:59)
    at com.android.tools.idea.res.ProjectResourceRepository.computeRepositories(ProjectResourceRepository.java:81)
    at com.android.tools.idea.res.ProjectResourceRepository.create(ProjectResourceRepository.java:73)
    at com.android.tools.idea.res.ResourceRepositories.lambda$getProjectResources$1(ResourceRepositories.java:83)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
    at com.android.tools.idea.res.ResourceRepositories.getProjectResources(ResourceRepositories.java:80)
    at com.android.tools.idea.res.ProjectResourceRepository.findProjectResources(ProjectResourceRepository.java:63)
    at com.android.tools.idea.res.ProjectResourceRepository.getOrCreateInstance(ProjectResourceRepository.java:51)
    at com.android.tools.idea.res.AppResourceRepository.computeRepositories(AppResourceRepository.java:156)
    at com.android.tools.idea.res.AppResourceRepository.create(AppResourceRepository.java:123)
    at com.android.tools.idea.res.ResourceRepositories.lambda$getAppResources$0(ResourceRepositories.java:68)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
    at com.android.tools.idea.res.ResourceRepositories.getAppResources(ResourceRepositories.java:65)
    at com.android.tools.idea.res.AppResourceRepository.findAppResources(AppResourceRepository.java:117)
    at com.android.tools.idea.res.AppResourceRepository.getOrCreateInstance(AppResourceRepository.java:99)
    at com.android.tools.idea.res.AppResourceRepository.getOrCreateInstance(AppResourceRepository.java:94)
    at com.android.tools.idea.configurations.ConfigurationManager.create(ConfigurationManager.java:177)
    at com.android.tools.idea.configurations.ConfigurationManager.getConfiguration(ConfigurationManager.java:151)
    at com.android.tools.idea.common.model.NlModel.<init>(NlModel.java:117)
    at com.android.tools.idea.common.model.NlModel.create(NlModel.java:106)
    at com.android.tools.idea.common.editor.NlEditorPanel.initNeleModelOnEventDispatchThread(NlEditorPanel.java:99)
    at com.intellij.openapi.project.DumbServiceImpl.lambda$smartInvokeLater$7(DumbServiceImpl.java:381)
    at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:303)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:410)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:827)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:655)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:365)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)


java.lang.IllegalArgumentException: Resource name cannot be empty.
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
    at com.android.ide.common.res2.ResourceItem.<init>(ResourceItem.java:115)
    at com.android.ide.common.res2.IdGeneratingResourceParser$IdResourceItem.<init>(IdGeneratingResourceParser.java:202)
    at com.android.ide.common.res2.IdGeneratingResourceParser.<init>(IdGeneratingResourceParser.java:81)
    at com.android.ide.common.res2.ResourceSet.createResourceFile(ResourceSet.java:456)
    at com.android.ide.common.res2.ResourceSet.createFileAndItems(ResourceSet.java:111)
    at com.android.ide.common.res2.ResourceSet.handleNewFile(ResourceSet.java:257)
    at com.android.ide.common.res2.ResourceSet.handleNewFile(ResourceSet.java:52)
    at com.android.ide.common.res2.DataSet.loadFile(DataSet.java:275)
    at com.android.tools.idea.res.ResourceFolderRepository$InitialScanState.loadFile(ResourceFolderRepository.java:325)
    at com.android.tools.idea.res.ResourceFolderRepository.scanFileResourceFile(ResourceFolderRepository.java:524)
    at com.android.tools.idea.res.ResourceFolderRepository.scanFileResourceFolder(ResourceFolderRepository.java:477)
    at com.android.tools.idea.res.ResourceFolderRepository.scanResFolder(ResourceFolderRepository.java:449)
    at com.android.tools.idea.res.ResourceFolderRepository.scanRemainingFiles(ResourceFolderRepository.java:375)
    at com.android.tools.idea.res.ResourceFolderRepository.<init>(ResourceFolderRepository.java:119)
    at com.android.tools.idea.res.ResourceFolderRepository.create(ResourceFolderRepository.java:152)
    at com.android.tools.idea.res.ResourceFolderRegistry.get(ResourceFolderRegistry.java:76)
    at com.android.tools.idea.res.ResourceFolderRegistry.get(ResourceFolderRegistry.java:64)
    at com.android.tools.idea.res.ModuleResourceRepository.create(ModuleResourceRepository.java:95)
    at com.android.tools.idea.res.ResourceRepositories.lambda$getModuleResources$2(ResourceRepositories.java:98)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
    at com.android.tools.idea.res.ResourceRepositories.getModuleResources(ResourceRepositories.java:95)
    at com.android.tools.idea.res.ModuleResourceRepository.findModuleResources(ModuleResourceRepository.java:71)
    at com.android.tools.idea.res.ModuleResourceRepository.getOrCreateInstance(ModuleResourceRepository.java:59)
    at com.android.tools.idea.res.ProjectResourceRepository.computeRepositories(ProjectResourceRepository.java:81)
    at com.android.tools.idea.res.ProjectResourceRepository.create(ProjectResourceRepository.java:73)
    at com.android.tools.idea.res.ResourceRepositories.lambda$getProjectResources$1(ResourceRepositories.java:83)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
    at com.android.tools.idea.res.ResourceRepositories.getProjectResources(ResourceRepositories.java:80)
    at com.android.tools.idea.res.ProjectResourceRepository.findProjectResources(ProjectResourceRepository.java:63)
    at com.android.tools.idea.res.ProjectResourceRepository.getOrCreateInstance(ProjectResourceRepository.java:51)
    at com.android.tools.idea.res.AppResourceRepository.computeRepositories(AppResourceRepository.java:156)
    at com.android.tools.idea.res.AppResourceRepository.create(AppResourceRepository.java:123)
    at com.android.tools.idea.res.ResourceRepositories.lambda$getAppResources$0(ResourceRepositories.java:68)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
    at com.android.tools.idea.res.ResourceRepositories.getAppResources(ResourceRepositories.java:65)
    at com.android.tools.idea.res.AppResourceRepository.findAppResources(AppResourceRepository.java:117)
    at com.android.tools.idea.res.AppResourceRepository.getOrCreateInstance(AppResourceRepository.java:99)
    at com.android.tools.idea.res.AppResourceRepository.getOrCreateInstance(AppResourceRepository.java:94)
    at com.android.tools.idea.configurations.ConfigurationManager.create(ConfigurationManager.java:177)
    at com.android.tools.idea.configurations.ConfigurationManager.getConfiguration(ConfigurationManager.java:151)
    at com.android.tools.idea.common.model.NlModel.<init>(NlModel.java:117)
    at com.android.tools.idea.common.model.NlModel.create(NlModel.java:106)
    at com.android.tools.idea.common.editor.NlEditorPanel.initNeleModelOnEventDispatchThread(NlEditorPanel.java:99)
    at com.intellij.openapi.project.DumbServiceImpl.lambda$smartInvokeLater$7(DumbServiceImpl.java:381)
    at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:303)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:410)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:827)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:655)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:365)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)


java.lang.IllegalArgumentException: Resource name cannot be empty.
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
    at com.android.ide.common.res2.ResourceItem.<init>(ResourceItem.java:115)
    at com.android.ide.common.res2.IdGeneratingResourceParser$IdResourceItem.<init>(IdGeneratingResourceParser.java:202)
    at com.android.ide.common.res2.IdGeneratingResourceParser.<init>(IdGeneratingResourceParser.java:81)
    at com.android.ide.common.res2.ResourceSet.createResourceFile(ResourceSet.java:456)
    at com.android.ide.common.res2.ResourceSet.createFileAndItems(ResourceSet.java:111)
    at com.android.ide.common.res2.ResourceSet.handleNewFile(ResourceSet.java:257)
    at com.android.ide.common.res2.ResourceSet.handleNewFile(ResourceSet.java:52)
    at com.android.ide.common.res2.DataSet.loadFile(DataSet.java:275)
    at com.android.tools.idea.res.ResourceFolderRepository$InitialScanState.loadFile(ResourceFolderRepository.java:325)
    at com.android.tools.idea.res.ResourceFolderRepository.scanFileResourceFile(ResourceFolderRepository.java:524)
    at com.android.tools.idea.res.ResourceFolderRepository.scanFileResourceFolder(ResourceFolderRepository.java:477)
    at com.android.tools.idea.res.ResourceFolderRepository.scanResFolder(ResourceFolderRepository.java:449)
    at com.android.tools.idea.res.ResourceFolderRepository.scanRemainingFiles(ResourceFolderRepository.java:375)
    at com.android.tools.idea.res.ResourceFolderRepository.<init>(ResourceFolderRepository.java:119)
    at com.android.tools.idea.res.ResourceFolderRepository.create(ResourceFolderRepository.java:152)
    at com.android.tools.idea.res.ResourceFolderRegistry.get(ResourceFolderRegistry.java:76)
    at com.android.tools.idea.res.ResourceFolderRegistry.get(ResourceFolderRegistry.java:64)
    at com.android.tools.idea.res.ModuleResourceRepository.create(ModuleResourceRepository.java:95)
    at com.android.tools.idea.res.ResourceRepositories.lambda$getModuleResources$2(ResourceRepositories.java:98)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
    at com.android.tools.idea.res.ResourceRepositories.getModuleResources(ResourceRepositories.java:95)
    at com.android.tools.idea.res.ModuleResourceRepository.findModuleResources(ModuleResourceRepository.java:71)
    at com.android.tools.idea.res.ModuleResourceRepository.getOrCreateInstance(ModuleResourceRepository.java:59)
    at com.android.tools.idea.res.ProjectResourceRepository.computeRepositories(ProjectResourceRepository.java:81)
    at com.android.tools.idea.res.ProjectResourceRepository.create(ProjectResourceRepository.java:73)
    at com.android.tools.idea.res.ResourceRepositories.lambda$getProjectResources$1(ResourceRepositories.java:83)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
    at com.android.tools.idea.res.ResourceRepositories.getProjectResources(ResourceRepositories.java:80)
    at com.android.tools.idea.res.ProjectResourceRepository.findProjectResources(ProjectResourceRepository.java:63)
    at com.android.tools.idea.res.ProjectResourceRepository.getOrCreateInstance(ProjectResourceRepository.java:51)
    at com.android.tools.idea.res.AppResourceRepository.computeRepositories(AppResourceRepository.java:156)
    at com.android.tools.idea.res.AppResourceRepository.create(AppResourceRepository.java:123)
    at com.android.tools.idea.res.ResourceRepositories.lambda$getAppResources$0(ResourceRepositories.java:68)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
    at com.android.tools.idea.res.ResourceRepositories.getAppResources(ResourceRepositories.java:65)
    at com.android.tools.idea.res.AppResourceRepository.findAppResources(AppResourceRepository.java:117)
    at com.android.tools.idea.res.AppResourceRepository.getOrCreateInstance(AppResourceRepository.java:99)
    at com.android.tools.idea.res.AppResourceRepository.getOrCreateInstance(AppResourceRepository.java:94)
    at com.android.tools.idea.configurations.ConfigurationManager.create(ConfigurationManager.java:177)
    at com.android.tools.idea.configurations.ConfigurationManager.getConfiguration(ConfigurationManager.java:151)
    at com.android.tools.idea.common.model.NlModel.<init>(NlModel.java:117)
    at com.android.tools.idea.common.model.NlModel.create(NlModel.java:106)
    at com.android.tools.idea.common.editor.NlEditorPanel.initNeleModelOnEventDispatchThread(NlEditorPanel.java:99)
    at com.intellij.openapi.project.DumbServiceImpl.lambda$smartInvokeLater$7(DumbServiceImpl.java:381)
    at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:303)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:410)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:827)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:655)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:365)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

我不知道如何解决这些问题,因为我已经尝试使缓存失效,删除我的.idea和iml文件并禁用电源安全模式。

我如何解决这些问题?

Project gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://maven.google.com" }

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

App gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "com.example.sanchez.worldgramproject"
        minSdkVersion 21
        targetSdkVersion 26
        multiDexEnabled true
        versionCode 0
        versionName "0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }
}



dependencies {

    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.github.madrapps:pikolo:1.1.6'
    compile 'com.android.support:design:26.1.0'
    compile 'com.github.bumptech.glide:glide:3.8.0'
    compile 'com.firebaseui:firebase-ui-storage:2.3.0'
    compile 'com.google.firebase:firebase-auth:11.8.0'
    compile 'com.google.android.gms:play-services-auth:11.8.0'
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.google.android.gms:play-services:11.8.0'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.jakewharton:butterknife:8.8.1'
    compile 'com.android.support:multidex:1.0.2'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.6'
    compile 'de.hdodenhof:circleimageview:2.2.0'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.android.support:exifinterface:26.1.0'
    compile 'com.google.firebase:firebase-storage:11.8.0'
    compile 'com.google.firebase:firebase-database:11.8.0'
    testCompile 'junit:junit:4.12'

}

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.0'
            }
        }
    }
}

apply plugin: 'com.google.gms.google-services'

0 个答案:

没有答案