2017-10-27 11 views
0

私のアプリケーションには、 'models'というフォルダに保持され、 'com.myname.appname.models.classname'を介してアクセスされるいくつかのカスタムクラスがあります。最近までうまくいきましたが、突然、これらのクラスの1つを使用するレイアウトを膨らませようとするとクラッシュしてしまいます。Androidスタジオにカスタムクラスのファイルパスが間違っています

次のように私は取得していますエラーは次のとおりです。

android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class com.myname.appname.ColourCell 
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class com.myname.appname.ColourCell 
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.myname.appname.ColourCell" on path: DexPathList[...] 

だから、com.myname.appname.ColourCell代わりのcom.myname.appname.models.ColourCellを探しています。

私が動作するようには思えいずれも次のソリューション、ClassNotFoundExceptionがエラーをGoogleで検索し、見つけた

  • '達人' のサポート
  • の無効化を追加MultiDex
  • 更新compileSDKVersionを有効にしますインスタントラン

ラプラシアンを膨らませようとすると同じエラーでクラッシュするユート。

私は次に何を試すべきか分かりません。私は全くgradleを理解していない - 私はいつもそれを使用した!私はしました

buildscript { 
    repositories { 
     jcenter() 
     maven { 
      url "https://maven.google.com" 
     } 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.3' 
     classpath 'com.google.gms:google-services:3.0.0' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
     maven { 
      url "https://maven.google.com" 
     } 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

アプリ:

apply plugin: 'com.android.application' 
apply plugin: 'com.google.gms.google-services' 

android { 
    signingConfigs { 
     config { 
      keyAlias 'xxx' 
      keyPassword 'xxx' 
      storeFile file('xxx') 
      storePassword 'xxx' 
     } 
    } 
    compileSdkVersion 26 
    buildToolsVersion "26.0.2" 
    defaultConfig { 
     applicationId "com.myname.appname" 
     minSdkVersion 21 
     targetSdkVersion 26 
     versionCode 7 
     versionName "1.0.2" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     multiDexEnabled true 
    } 
    buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
      signingConfig signingConfigs.config 
     } 
     debug { 
      minifyEnabled false 
     } 
    } 
    productFlavors { 
     freeConfig { 
      applicationId 'com.myname.appname.free' 
     } 
     paidConfig { 
      applicationId 'com.myname.appname.full' 
     } 
    } 
    packagingOptions { 

     exclude 'META-INF/DEPENDENCIES.txt' 
     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/notice.txt' 
     exclude 'META-INF/license.txt' 
     exclude 'META-INF/dependencies.txt' 
     exclude 'META-INF/LGPL2.1' 

    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile project(path: ':backend', configuration: 'android-endpoints') 
    compile 'com.android.support:appcompat-v7:26.0.0-beta1' 
    compile 'com.android.support:design:26.0.0-beta1' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    compile 'com.google.code.findbugs:jsr305:2.0.1' 
    compile 'com.google.firebase:firebase-auth:10.0.1' 
    compile 'com.google.firebase:firebase-database:10.0.1' 
    compile 'com.google.firebase:firebase-ads:10.0.1' 
    compile 'com.firebase:firebase-client-android:2.5.0' 
    compile 'com.google.firebase:firebase-core:10.0.1' 
    compile 'com.firebaseui:firebase-ui-database:1.1.1' 
    compile 'com.android.support:multidex:1.0.1' 
    testCompile 'junit:junit:4.12' 
} 

アプリ名を私はオンラインしかし、Gradleのファイルを中心に見えたので、私は以下のそれらを含めましたソリューションプロジェクトを掃除して再構築しましたが、成功しませんでした。その特定のinflateステートメントに到達し、見つからないクラスを使用しようとするまでは正常に実行されています。私は次に何を試していいか分からないので、絶望的になってきている。助けを借りれば喜んでいただけると思います。

答えて

0

私は脳波を持っていて、 'ColourCell'クラスをASが探していたパスに( 'refactor'メニューオプションを介して)移動しました。私はそれを再び(「リファクタ」を介して)「モデル」に戻すことができました。それはまだ機能しています。それが他の誰にも役立つ場合は、ここで質問を残しておきます。

関連する問題