2017-10-26 3 views
0

사용 중 Android Studio 3 Stable입니다. 다음 this사용자 정의 글꼴 배열이 Android Studio 3에 없습니다.

튜토리얼 나는 데모 인스턴트 응용 프로그램을 만들었습니다. 모든 단계를 완료 한 후에 아무 문제없이 내 에뮬레이터에서 실행되고있었습니다. 그런 다음 사용자 지정 글꼴을 사용하고 싶습니다. 레이아웃 편집기에서 TextView 용 사용자 지정 글꼴을 설정했습니다.

텍스트 뷰의 XML :
`

<TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Hello World!" 
     android:fontFamily="@font/dancing_script" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toTopOf="parent" /> 

`
글꼴 XML :

<font-family xmlns:app="http://schemas.android.com/apk/res-auto" 
     app:fontProviderAuthority="com.google.android.gms.fonts" 
     app:fontProviderPackage="com.google.android.gms" 
     app:fontProviderQuery="Dancing Script" 
     app:fontProviderCerts="@array/com_google_android_gms_fonts_certs"> 
</font-family> 


매니페스트

manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.myfirstinstantapp.feature"> 

    <application> 
     <activity android:name=".MainActivity"> 
      <intent-filter android:order="1"> 
       <action android:name="android.intent.action.VIEW" /> 

       <category android:name="android.intent.category.BROWSABLE" /> 
       <category android:name="android.intent.category.DEFAULT" /> 

       <data 
        android:host="myfirstinstantapp.example.com" 
        android:pathPattern="/hello" 
        android:scheme="https" /> 
      </intent-filter> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <meta-data 
      android:name="preloaded_fonts" 
      android:resource="@array/preloaded_fonts" /> 
    </application> 

</manifest> 


폴더 구조
enter image description here


하지만 난 오류 다음 내가 을 얻을 구축 할 때 :

Error:(52) resource array/preloaded_fonts (aka com.example.myfirstinstantapp:array/preloaded_fonts) not found. 
 
Error:(52) error: resource array/preloaded_fonts (aka com.example.myfirstinstantapp:array/preloaded_fonts) not found. 
 
Error:failed processing manifest. 
 
D:\Android\AndroidStudioProjects\MyFirstInstantApp\base\build\intermediates\manifests\full\feature\debug\AndroidManifest.xml 
 
Error:java.util.co`enter code here`ncurrent.ExecutionException: java.util.concurre`enter code here`nt.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details 
 
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details 
 
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details 
 
Error:Execution failed for task ':base:processDebugFeatureResources'. 
 
> Failed to execute aapt 
 
Information:BUILD FAILED in 2s 
 
Information:7 errors

내가 놓친 것이 있습니까?

답변

0

같은 문제가 발생합니다. 하나의 배열 파일을 값으로 만들고 아래 코드를 사용하십시오. Refer

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <array name="preloaded_fonts"> 
     <item>@font/dancing_script </item> 
    </array> 
</resources>