Android 부트 스트랩 및 Android Studio는 라이브러리를 추가 할 수 없습니다
-
26-12-2019 - |
문제
Android 부트 스트랩 라이브러리 ~ 내 프로젝트에 Android Studio를 추가하고 싶습니다 (나는 이 자습서 )을 따랐습니다.
프로젝트 탐색기에서 Android 부트 스트랩과 프로젝트를 볼 수 있지만 부트 스트랩 버튼을 추가하려고하면
<!-- basic button -->
<com.beardedhen.androidbootstrap.BootstrapButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Success"
bootstrapbutton:bb_icon_right="fa-android"
bootstrapbutton:bb_type="success"
/>
.
다음과 같은 오류 메시지가 나타납니다.
android-apt-compiler : layout / activitito_main.xml : 56 : 오류 : 'com.carfinder'패키지의 'bb_icon_right'속성에 대한 자원 식별자 없음
무엇을 잘못하고 있습니까?
해결책
업데이트 :
프로젝트 구조 가이처럼 보이는지 확인하십시오. 라이브러리는 라이브러리> AndroidBootStraplary 문제가 없습니다.이 경우에는 Settings.Gradle 및 Build.Gradle에서 경로를 변경해야합니다.
----YOUR_PROJECT
---AndroidBootStrapLibrary
--res
--src
-- .....
-- build.gradle(must contain apply plugin: 'android-library'
if not that menas not library project you have added something wrong)
---YOUR_MODULE
--res
--src
--build.gradle (no : A)
----settings.gradle
.
build.gradle (No. A) 파일
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:support-v4:18.0.+'
compile project(':AndroidBootStrapLibrary')
}
.
settings.gradle :
include ':YOUR_MODULE'
include ':AndroidBootStrapLibrary'
.
모든
가 발생한 후 졸업생과 동기화 프로젝트 수행 p>
라이브러리의 사용자 정의보기에 대한 네임 스페이스를 추가하는 것을 잊었습니다. p>
이 p>로 버튼을 위해 코드를 복제합니다.
사용중인 경우 다른 뷰에 네임 스페이스를 추가하십시오. 레이아웃 파일의 루트 요소에도 레이아웃 파일의 루트 요소에 추가 할 수도 있습니다 p>
여기에 하나의 작업 테스트 프로젝트를 업로드했습니다 (체크 아웃 양식 GitHub in As) p>
.
<com.beardedhen.androidbootstrap.BootstrapButton
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Success"
bootstrapbutton:bb_icon_right="fa-android"
bootstrapbutton:bb_type="success"
/>
.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.app.MainActivity$PlaceholderFragment">
<TextView
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.beardedhen.androidbootstrap.BootstrapButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Success"
bootstrapbutton:bb_icon_right="fa-android"
bootstrapbutton:bb_type="success"
/>
</RelativeLayout>
다른 팁
누군가 가이 라이브러리를 추가하려고 하고이 질문을 통해 오는 경우에만 다른 문제가 있지만, 저를 위해 일한 전체 단계를 언급할만한 가치가 있다고 생각합니다 ( 여기에 다른 도서관 :