Android Studio : Error:Dependency unspecified on project resolves to an APK archive which is not supported as a compilation dependency.

Android Studio เมื่อมีการเพิ่มโมดูล (Import Module) เข้ามาในโปรเจ็ค เราจะต้องเพิ่มโมดูลนั้นที่ build.gradle ของโปรโจ็คด้วย โดยเพิ่มในส่วนของ dependencies { … } ดังตัวอย่าง

dependencies {
….
compile project(‘:new_module’)
}

จากนั้น anroid studio จะทำการ buile sync gradle ใหม่ แต่ทว่ากลับพบว่าเจอ Error Message ดังนี้

Error:Dependency App:unspecified on project new_module resolves to an APK archive which is not supported as a compilation dependency. File: {path}/libs/new_module/build/outputs/apk/new_module-release-unsigned.apk

จาก Error Message ให้เราเปิด build.gradle ของโมดูลที่เพิ่งเพิ่มขึ้นมาจากตัวอย่าง ต้องเปิด build.gradle(Module: new_module) แล้วตรวจดูว่า มีการกำหนด applicationId หรือเปล่า ถ้ามีให้ลบออก ดังตัวอย่าง

defaultConfig {
applicationId “com.example.new_module”
minSdkVersion 18
targetSdkVersion 17
}

จากนั้นทำการคอมไพล์ gradle ใหม่ครับ

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *