Android Studio 3.0 升级以后若干环境问题解决

1. Android Studio 运行时提示 ” Please select Android SDK“

将gradle编译的minSDK version 改为 17 以上

是因为升级了build tools的原因,要打开project structure将 Build Tools Version改成最新的

 

2.升级Android Studio 3.0之后,项目报错 Error:Removing unused resources requires unused code shrinking to be turned on.

在gradle编译脚本中把shrinkResources true加上重新编译,可clean一下:

buildTypes {
        debug {
            applicationIdSuffix ".debug"
            minifyEnabled false
            shrinkResources false
            zipAlignEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            minifyEnabled true
            shrinkResources true
            zipAlignEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }

 

3. 编译时报错:Error:All flavors must now belong to a named flavor dimension.

在gradle文件中使用以下方式声明flavor:

android {

    flavorDimensions "official"

    productFlavors {
        official {
            dimension "official"
            manifestPlaceholders = [CHANNEL_VALUE: "official"]
        }
    }

    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }

    lintOptions {
        abortOnError false
    }
}

 

4. 升级到gradle4.4, AS plugin 3.1.2之后出现gradle编译报错的问题

Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.

It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

gradle编译文件将之前的 compile 改成 implementation 或者 api

dependencies {

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

androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {

exclude group: 'com.android.support', module: 'support-annotations'

})

implementation 'com.android.support:appcompat-v7:25.4.0'

testImplementation 'junit:junit:4.12'
implementation 'com.google.android.gms:play-services-appindexing:8.4.0'

implementation 'com.alibaba:fastjson:1.2.22'
}

 

 

5. AndroidStudio 3.0 style attribute '@android:attr/windowEnterAnimation' not found 解决办法:

将前面的@字符去掉:

如:

将<item name="@android:windowEnterAnimation">@anim/pop_scale_up_in</item>

改为:

<item name="android:windowEnterAnimation">@anim/pop_scale_up_in</item>

 

6 . Program type already present: android.support.design.widget.CoordinatorLayout$Behavior

 

这个是因为加入android support design库之后跟ConstraintLayout的版本冲突导致

 

7. 升级android studio 3.3.2之后,manifest.xml出现大片的警告信息:

App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW intent filter. See issue explanation for more details. less... (Ctrl+F1) 
Inspection info:Adds URLs to get your app into the Google index, to get installs and traffic to your app from Google Search.  Issue id: GoogleAppIndexingWarning

解决办法:

可以在 launch activity加入一个intent filter,如:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

也可以在app的build.gradle文件加入这句:

lintOptions {  
        disable 'GoogleAppIndexingWarning'  
} 

 

8.strings.xml文件打开出现大量is not translated in "de" (German), "fi" (Finnish)的红色警告,如下图所示:

解决方法:

在resources的根节点添加 tools:ignore="MissingTranslation"

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"
    xmlns:tools="http://schemas.android.com/tools"
    tools:ignore="MissingTranslation">
</resources>

 

 

 

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值