문제

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'
.

모든

가 발생한 후 졸업생과 동기화 프로젝트 수행

그라데이션이있는 프로젝트 동기화 loading=

라이브러리의 사용자 정의보기에 대한 네임 스페이스를 추가하는 것을 잊었습니다.

로 버튼을 위해 코드를 복제합니다.

     <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>
.

여기에 하나의 작업 테스트 프로젝트를 업로드했습니다 (체크 아웃 양식 GitHub in As)

https://github.com/pyus-13/tesstapp.git

다른 팁

누군가 가이 라이브러리를 추가하려고 하고이 질문을 통해 오는 경우에만 다른 문제가 있지만, 저를 위해 일한 전체 단계를 언급할만한 가치가 있다고 생각합니다 ( 여기에 다른 도서관 :

  1. Android Studio
  2. 에서 프로젝트를 엽니 다.
  3. 라이브러리를 다운로드 (GIT 사용 또는 압축 ZIP 아카이브 사용)
  4. 라이브러리> AndroidBootStrap> Build.Gradle
  5. 라이브러리를 압축 해제하는 폴더로 이동하십시오.
  6. 삭제 'Push.Gradle'
  7. integer.parseint (target_sdk_int), integer.parseparseparseint (min_sdk_int), integer.parseint (version_code), verse_name, "25.0.1"을 프로젝트의 버전으로 바꿉니다. 그라데이션 스크립트에서 찾을 수 있습니다> build.gradle
  8. 파일> 모듈 가져 오기 및 라이브러리 가져 오기 ( androidbootstrap 폴더 만 필요합니다)
  9. 파일> 프로젝트 구조
  10. 로 이동
  11. 주 프로젝트 모듈을 찾아 클릭하십시오. (또한 AndroidBootStrap은 IT 아래 AndroidBootstrap을보아야합니다)
  12. 그것을 클릭하고 종속성으로 이동하십시오.
  13. 왼쪽 녹색 "+"버튼> 모듈 종속성
  14. 를 클릭하십시오.
  15. "AndroidBooStrap"
  16. 를 선택하십시오.

    이제 모든 것이 작동해야합니다.

    AndroidBooStrap 라이브러리에서 요소를 추가하려고하면 .xml 파일에 오류가 발생할 수 있습니다. "네임 스페이스 '앱'은 바인드되지 않습니다.". Android Studio의 오류로 Alt + Enter를 클릭 하거나이 행을 추가 하여이 문제를 해결할 수 있습니다.

    xmlns:app="http://schemas.android.com/apk/res-auto"
    
    .

    선언 또는 레이아웃과 xmlns : 도구 e.g

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    
    .

    나는 이것이 Android 초보자로서 라이브러리를 포함하는 방법에 대해 가장 정확한 해결책이지만, 저에게는 일했습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top