没法贴图,之前还是没问题的,现在打开 Design 标签,预览图是空白,中间显示 android...DrawerLayout Build.gradle 如下: apply plugin: 'com.android.application'
android { compileSdkVersion 28 defaultConfig { applicationId "com.example.nettywificomp" minSdkVersion 21 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } } buildToolsVersion '28.0.3' }
dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support:design:28.0.0' implementation 'de.hdodenhof:circleimageview:2.1.0' implementation 'javolution:javolution:5.3.1' implementation 'com.contrarywind:Android-PickerView:4.1.7' implementation 'com.github.huangyanbin:SmartTable:2.2.0' implementation 'com.github.GrenderG:Toasty:1.4.0' implementation 'com.nbsp:library:1.8' 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' }
看 StackOverflow 提示说降到 27,但是降到 27 还是一堆 Error 有遇到过这个问题的吗,求助。
1
xbigfat 2019-02-26 11:44:34 +08:00
无法预览是因为 Gradle 没有 Fully Sync 所以资源有错误。
高阶 compileSdkVersion 降级到低阶会出现资源错误,特别是 Theme 之类的 Resource 文件错误 建议就用 28 降下来要删除很多东西的和依赖 |
2
xbigfat 2019-02-26 11:48:48 +08:00
还有就是代码贴的规范一点,帮你尝试格式化了不知道会不会成功。。。
``` android { compileSdkVersion 28 defaultConfig { applicationId "com.example.nettywificomp" minSdkVersion 21 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } } buildToolsVersion '28.0.3' } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support:design:28.0.0' implementation 'de.hdodenhof:circleimageview:2.1.0' implementation 'javolution:javolution:5.3.1' implementation 'com.contrarywind:Android-PickerView:4.1.7' implementation 'com.github.huangyanbin:SmartTable:2.2.0' implementation 'com.github.GrenderG:Toasty:1.4.0' implementation 'com.nbsp:library:1.8' 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' } ``` |
3
zoeyzhang 2019-02-26 15:00:25 +08:00
预览不了的话 可以先看下 design 页的 issues 会有 warning 和 error 提示 可能是高版本 theme 不兼容的问题
|
4
diy886 2019-02-26 16:37:06 +08:00
项目能运行吗,不能的话先调通
试试预览界面改 theme 和 invalidate cache/restart |
5
huruwo 2019-02-27 00:15:25 +08:00
theme 继承 base 试试 我就是预览不了说主题样式问题 改成 base 就行
|