我刚从File> New> Activity创建了一个空白活动 . 其MainActivity.java是可编辑的,与menu_main.xml相同,但无法打开activity_main.xml布局文件 . 没有任何错误消息,没有迹象表明发生任何事情,没有任何事情 . 我也尝试删除活动并再次创建它 .
Android Studio更新到最新版本(1.2.1.1),我尝试打开和关闭它 . 我在Mac OS X 10.10.3上运行它,该文件存在于IDE所说的文件系统中 .
有没有人遇到过这个问题?
编辑:刚试过重新启动我的电脑,同样的事情发生了 .
编辑2:我的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "ca.etsmtl.gti785.telebama"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
testCompile 'junit:junit:4.12'
testCompile('org.robolectric:robolectric:3.0-rc2') {
exclude group: 'commons-logging', module: 'commons-logging'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
}
4 回答
我有同样的问题 . 重建,清理,重启mac,重新安装Android Studio,安装不同的Android Studio版本......没有任何效果 .
然后我发现 the problem was gradle, not Android Studio . 在gradle-wrapper.properties中我 changed the version from 3.3 to 3.5 :
这解决了我的问题 .
如果在任何其他窗口中打开任何其他项目,则关闭它 . 现在关闭当前项目 . 首先打开您打算工作的项目 . 你会好起来的 .
请清理并构建您的项目 .
重新加载xml文件转到src-> main-> res-> layout-> activity_main.xml .
我猜测问题可能在选定的预览API或设备中 . 在预览中查看此工具栏 .