1. 程式人生 > >Android studio 3.0 and sd報錯Error: Flag android.useDeprecatedNdk is no longer supported and will be r

Android studio 3.0 and sd報錯Error: Flag android.useDeprecatedNdk is no longer supported and will be r

今天學習用NDK進行開發,執行到手機上報了個錯,先把錯誤日誌貼上:

Error: Flag android.useDeprecatedNdk is no longer supported and will be removed in the next version of Android Studio.  Please switch to a supported build system.
  Consider using CMake or ndk-build integration. For more information, go to:
   https://d.android.com/r/studio-ui/add-native-code.html#ndkCompile
   To get started, you can use the sample ndk-build script the Android
   plugin generated for you at:
   E:\SwimmingSpace\ndktest\build\intermediates\ndk\debug\Android.mk
  Alternatively, you can use the experimental plugin:
   https://developer.android.com/r/tools/experimental-plugin.html
  To continue using the deprecated NDK compile for another 60 days, set 
  android.deprecatedNdkCompileLease=1515138691572 in gradle.properties

剛開始開這個錯誤日誌有點懵了,但是我們仔細看一下會發現android.useDeprecatedNdk不在被支援了,但是在日誌後面給了我們一個解決辦法To continue using the deprecated NDK compile for another 60 days, set 

  android.deprecatedNdkCompileLease=1515138691572 in gradle.properties大概意思是想要繼續使用已棄用的NDK編譯60天,在gradle.properties檔案裡把android.useDeprecatedNdk去掉換成android.deprecatedNdkCompileLease=1515138691572就行了,我猜有肯能每個人錯誤日誌裡得到android.deprecatedNdkCompileLease=1515138691572不一定一樣,所以儘量使用自己錯日誌裡的進行執行。