Android Studio打包APK是遇到的一些問題(Lint檢查的錯誤)

一,Error* : expected resource of type drawable
 原因:animation-list的文件放在anim文件夾下了
 解決的兩種方式:
   1,移動文件到drawable文件夾下
   2,替換
      _loadigIcon.setImageResource(R.anim.loading_animation);
   爲
      _loadigIcon.setImageResource(+R.anim.loading_animation);


二、obtainStyledAttributes annotated with @StyleableRes. Suppress warnings(expected resource of type
   原因:TypedArray ta = obtainStyledAttributes(R.style.MyCustomStyle, attrs)
   解決:(在它的函數上添加)
     @SuppressWarnings("ResourceType")



三、Android xxx is not translated in zh
    原因:在默認的strings.xml中有值,但是在values-zh文件夾下的srings.xml中沒有值導致
    
   Lint的終極解決辦法:
          在主項目的builde.gralde裏添加如下代碼

	android {
		lintOptions {
			checkReleaseBuilds false
			// Or, if you prefer, you can continue to checkforerrorsinrelease builds,
			// but continue the build even whenerrorsarefound:
			abortOnError false
		}
	}


發佈了50 篇原創文章 · 獲贊 22 · 訪問量 13萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章