Android 라이브러리를 사용하면 여러 애플리케이션에서 컴포넌트를 재사용하거나, 동일한 핵심 컴포넌트로 하나의 앱 배리에이션을 빌드할 수 있습니다. Android 라이브러리는 Android 앱 모듈의 종속성으로 사용할 수 있는 AAR(Android Archive) 파일로 컴파일됩니다.
AAR(Android Archive) 플러그인은 컴파일된 Java, 네이티브(C/C++) 코드, 리소스 또는 Android 매니페스트가 포함된 번들입니다. .aar 파일 자체는 모든 에셋을 포함하는 zip 아카이브입니다. 자세한 내용은 Android 라이브러리 생성에 대한 Android 개발자 문서를 참조하십시오.
AAR 플러그인을 프로젝트에 추가하려면 .aar 파일을 Assets/Plugins/Android/libs 경로 내 아무 위치에나 복사합니다. 그리고 Unity의 인스펙터 창에서 임포트 설정을 열고 선택합니다. Android 체크박스를 활성화하여 .aar 파일을 Unity와 호환 가능으로 표시합니다.
Android 라이브러리 프로젝트는 AAR 플러그인과 비슷하며 네이티브 및 Java 코드, 리소스 및 Android 매니페스트가 포함되어 있습니다. 그러나 Android 라이브러리는 단일 아카이브 파일이 아니라 모든 에셋을 포함하는 특별한 구조의 디렉토리입니다. Android 라이브러리 프로젝트를 만드는 가장 쉬운 방법은 Android Studio에서 이 타입의 프로젝트를 생성하는 것입니다. 자세한 내용은 Android 라이브러리 생성에 대한 Android 개발자 문서를 참조하십시오.
Android 라이브러리 프로젝트를 지원하려면 Unity용 .androidlib 확장자가 있어야 합니다. 이 확장자를 라이브러리의 루트 폴더 이름에 추가(예: mylibrary.androidlib
)하고, 폴더를 Unity 프로젝트의 Assets
폴더에 배치하십시오. Unity는 여러 하위 프로젝트가 있는 Android Studio 프로젝트를 빌드하는 것과 동일한 방식으로 모든 Android 라이브러리를 최종 Gradle 프로젝트에 자동으로 포함하여 함께 빌드합니다.
자세한 내용은 라이브러리 모듈에 대한 Android Studio 문서를 참조하십시오.
출력 패키지에 그대로 복사해야 하는 에셋을 Unity 앱에 추가해야 하는 경우 Assets/Plugins/Android/assets
폴더로 임포트하십시오. 그러면 APK의 assets/
디렉토리에 복사됩니다. Java 코드에서 getAssets()
Android API를 호출하여 액세스할 수 있습니다.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.