升级至Android Studio 3.1.2后遭遇三类技术问题求助
Solutions for Android Studio 3.1.2 Post-Upgrade Issues
Let’s walk through each of your problems with practical, actionable fixes:
1. Missing Kotlin Class Creation Option
- Check if the Kotlin plugin is enabled: Head to
File > Settings > Plugins(Windows/Linux) orAndroid Studio > Preferences > Plugins(Mac). Search for "Kotlin"—if it’s disabled, toggle it on and restart Studio. - Verify Kotlin is configured in your project:
- Open your root
build.gradleand confirm the Kotlin classpath is present:buildscript { dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.51" // Use a version compatible with AS 3.1.2 } } - In your app module’s
build.gradle, ensure these plugins are applied at the top:apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' - Sync your project after making these changes.
- Open your root
2. No Import Smart Hints
- Turn on auto-import settings:
- Go to
File > Settings > Editor > General > Auto Import(Windows/Linux) orAndroid Studio > Preferences > Editor > General > Auto Import. - Under both Java and Kotlin sections, check
Add unambiguous imports on the flyandOptimize imports on the fly.
- Go to
- Invalidate caches and restart:
- Select
File > Invalidate Caches / Restart..., then chooseInvalidate and Restart. This fixes most cache-related glitches that pop up after upgrades.
- Select
3. No Syntax Highlighting (Code Only Gray)
- Invalidate caches first: As mentioned above, this is the quickest fix for rendering issues like missing syntax color.
- Check file type associations:
- Navigate to
File > Settings > Editor > File Types(Windows/Linux) orAndroid Studio > Preferences > Editor > File Types. - For Kotlin, ensure
.ktand.ktsare listed under the "Kotlin" file type. If not, add them manually.
- Navigate to
- Confirm project language level:
- Press
Ctrl+Alt+Shift+Sto open Project Structure. Select your app module, go to theSourcestab, and set the Language level to match your target SDK (e.g., "8 - Lambdas, type annotations etc." for API 26+).
- Press
- Reset your color scheme:
- Go to
File > Settings > Editor > Color Scheme(Windows/Linux) orAndroid Studio > Preferences > Editor > Color Scheme. Pick a default scheme like Darcula or IntelliJ Light and apply it—custom schemes sometimes break during upgrades.
- Go to
If none of these steps resolve the issues, consider a clean reinstall of Android Studio 3.1.2 (be sure to export your settings first via File > Export Settings).
内容的提问来源于stack exchange,提问作者EL TEGANI MOHAMED
相关产品推荐
相关产品推荐

