1

을 몇 시간 동안 처리하지 못했습니다. 왜 내가 컴파일 할 수 없는지 모르겠습니다. 나는 android.support.v7.widget.GridLayout을 포함 할 때, 내 미리보기 창에서 다음과 같은 오류를 참조하십시오android.support.v7.widget.GridLayout는

Rendering Problems The following classes could not be instantiated: 
- android.support.v7.widget.GridLayout (Open Class, Show Exception) 
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE Exception Details java.lang.ClassNotFoundException:     
android.support.v7.gridlayout.R$dimen   at   
java.net.URLClassLoader$1.run(URLClassLoader.java:202)   at 
java.security.AccessController.doPrivileged(AccessController.java:-2)   at   
java.net.URLClassLoader.findClass(URLClassLoader.java:190)   at 
java.lang.ClassLoader.loadClass(ClassLoader.java:306)   at 
java.lang.ClassLoader.loadClass(ClassLoader.java:247)   at 
android.support.v7.widget.GridLayout.<init>(GridLayout.java:255)   at 
android.support.v7.widget.GridLayout.<init>(GridLayout.java:274)   at 
java.lang.reflect.Constructor.newInstance(Constructor.java:513)   at  
android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755)   at 
android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)   at 
android.view.LayoutInflater.rInflate(LayoutInflater.java:727)   at 
android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:758)   at 
android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)   at 
android.view.LayoutInflater.rInflate(LayoutInflater.java:727)   at 
android.view.LayoutInflater.inflate(LayoutInflater.java:492)   at 
android.view.LayoutInflater.inflate(LayoutInflater.java:373) 

내가 컴파일 할 때, 나는 속성 모든 GridLayout과에 대한 오류의 번호를 형태의 사용하려고 :

내 주요 프로젝트 모듈과 같은 최상위 디렉토리에 SDK (/ 엑스트라/안드로이드/지원/V7/GridLayout과)에서 GridLayout과 모듈을 복사 한
view_edit_profile.xml:26: error: No resource identifier found for attribute 'orientation' in package 'com.company' 

. gridlayout 모듈을 내 메인 모듈의 모듈 종속성으로 설정하고 android-support-v7-gridlayout.jar을 프로젝트 라이브러리로 추가했습니다.

감사합니다.

UPDATE (게시 XML) :

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res/com.company" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/transparent" 
     android:paddingTop="@dimen/abs__action_bar_default_height" 
     android:paddingLeft="@dimen/margin_med" 
     android:paddingRight="@dimen/margin_med" 
     android:id="@+id/scrollView"> 

<LinearLayout 
    android:id="@+id/linearLayout_edit_profile" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:descendantFocusability="beforeDescendants" 
    android:focusableInTouchMode="true" 
    android:paddingBottom="@dimen/padding_med"> 

    <android.support.v7.widget.GridLayout 
     xmlns:grid="http://schemas.android.com/apk/res-auto" 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/gridLayout_pics" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     grid:orientation="horizontal" 
     grid:columnCount="3" 
     grid:rowCount="3" 
     grid:useDefaultMargins="true"> 
+0

view_edit_profile.xml 코드를 게시 할 수 있습니까? –

+0

xml이 게시되었습니다. 실제로 xmlns를 사용하여이 작업을 수행했습니다. 위에 게시 된 솔루션 –

답변

0

환경을 구축 어떤 IDE 또는를 사용하고 있습니까? 일반적으로 지원 lib JAR 파일을 프로젝트의 libs/서브 디렉토리에 넣고 빌드 환경의 클래스 경로에 추가해야합니다.

+0

감사합니다. Joe, Android Studio를 사용하고 있습니다. Gridlayout 모듈을 라이브러리 프로젝트로 설정하고 lib JAR을 내 메인 모듈에 대한 의존성으로 설정합니다. 실제로 xmlns, 위의 솔루션을 주위에 어지럽히하여 작동하도록이 있어요. –

0

위에서 설명한 해결책은 GridLayout 특성에 대해 별도의 xmlns (xmlns : grid)를 설정하는 것이 었습니다. 그러나 컴퓨터를 다시 시작해야만 몇 가지 이유로주의 할 수 있습니다. 예. Android.