Android Studio解決unspecified on project app resolves to an APK archive which is not supported

來源:互聯網
上載者:User

標籤:strong   uil   pos   highlight   tar   ted   res   project   出現   

出現該問題unspecified on project app resolves to an APK archive which is not supported as a compilation dependency的情形可能是:建立了兩個Module,其中一個Module依賴另一個Module而導致了出現該問題;

          如果在Android Studio中,有ModuleA和ModuleB,我們希望ModuleA依賴ModuleB,運行時候可能會出現該問題,查看被依賴的ModuleB的build.gradle,裡面可以看到:

  1. apply plugin: ‘com.android.application‘  


這句話告訴了Gradle將ModuleB編譯稱為application,也就是apk,這就是問題的所在;

解決方案:將上面該句改為:

  1. apply plugin: ‘com.android.library‘  


此時,Gradle將編譯稱為一個Library,也就是庫,運行之後,如果出現這個問題:Error:Library projects cannot set applicationId. applicationId is set to ‘package_name‘ in default config.,那是因為一個庫不允許設定applicationId,需要將builde.gradle — android — defaultConfig中的applicationId刪除;

 

 

如果說,我們ModuleB仍然需要產生apk,則我們需要將其中公用的代碼放到一個Module,作為一個support的庫;

 

http://stackoverflow.com/questions/27536491/how-to-import-android-project-as-library-and-not-compile-it-as-apk-android-stud

(轉)Android Studio解決unspecified on project app resolves to an APK archive which is not supported

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.