2017-10-23 30 views
0

私はReact Nativeでlottieフレームワークを実装しようとしています。 iOSで完璧に動作します。 Androidでアプリを実行しようとしているときに、次のエラーが表示されます。私は何が問題なのか、どこから来ているのか分かりません。私はインターネット上で検索し、解決策を見つけることができません。AndroidでLottie React Nativeが実行されていませんか?

/Users/xxxx/Desktop/BouncingBall/node_modules/lottie-react-native/lib/android/src/main/java/com/airbnb/android/react/lottie/LottieAnimationViewManager.java 
Error:(86, 46) error: cannot find symbol method toHashMap() 
Error:Execution failed for task ':lottie-react-native:compileReleaseJavaWithJavac'. 
> Compilation failed; see the compiler error output for details. 

/app/build.gradleファイル

apply plugin: "com.android.application" 

import com.android.build.OutputFile 


project.ext.react = [ 
    entryFile: "index.js" 
] 

apply from: "../../node_modules/react-native/react.gradle" 

def enableSeparateBuildPerCPUArchitecture = false 

def enableProguardInReleaseBuilds = false 

android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.2" 

    defaultConfig { 
     applicationId "com.bouncingball" 
     minSdkVersion 16 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     ndk { 
      abiFilters "armeabi-v7a", "x86" 
     } 
    } 
    splits { 
     abi { 
      reset() 
      enable enableSeparateBuildPerCPUArchitecture 
      universalApk false // If true, also generate a universal APK 
      include "armeabi-v7a", "x86" 
     } 
    } 
    buildTypes { 
     release { 
      minifyEnabled enableProguardInReleaseBuilds 
      proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 
     } 
    } 
    // applicationVariants are e.g. debug, release 
    applicationVariants.all { variant -> 
     variant.outputs.each { output -> 
      // For each separate APK per architecture, set a unique version code as described here: 
      // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 
      def versionCodes = ["armeabi-v7a":1, "x86":2] 
      def abi = output.getFilter(OutputFile.ABI) 
      if (abi != null) { // null for the universal-debug, universal-release variants 
       output.versionCodeOverride = 
         versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 
      } 
     } 
    } 
    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_7 
     targetCompatibility JavaVersion.VERSION_1_7 
    } 
} 

dependencies { 
    provided "com.facebook.react:react-native:+" 
    compile project(':lottie-react-native') 
    compile fileTree(dir: "libs", include: ["*.jar"]) 
    compile "com.android.support:appcompat-v7:26.+" 
    compile "com.facebook.react:react-native:+" // From node_modules 
    compile 'com.airbnb.android:lottie:2.2.5' 
} 

// Run this once to be able to run the application with BUCK 
// puts all compile dependencies into folder libs for BUCK to use 
task copyDownloadableDepsToLibs(type: Copy) { 
    from configurations.compile 
    into 'libs' 
} 

settings.gradleファイル

rootProject.name = 'BouncingBall' 
include ':lottie-react-native' 
project(':lottie-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/lottie-react-native/lib/android') 

include ':app' 

答えて

0

私は同じ問題がありました。リンクコマンドが完全に機能しません。ライブラリを手動でリンクする必要があります。これを行う方法がわからない場合は、build.gradleとsettings.gradleを投稿してください。

編集はGradleのファイル見た後:ここでは

を、あなたは二回lottieを持っている:

dependencies { 
    ... 
    compile project(':lottie-react-native') 
    ... 
    compile 'com.airbnb.android:lottie:2.2.5' 
} 

秒1は、ドキュメントで推奨一つですが、それは私が想定し、私のために動作しませんでした新しいRNバージョン。最初のものはlinkコマンドで追加されたもので、うまくいくはずです。 2番目のコンパイルをコメントアウトし、ビルドが完了したかどうかを確認してください。

+0

@ sfratini.build.gradleとsettings.gradleファイルを投稿しました。今すぐ確認していただけますか? – Sathya

+0

これはrootのbuild.gradleです。 android/appフォルダの中に別のものがあるはずです。設定のgradleはうまく見える – sfratini

+0

私はbuild.gradleファイルを更新しました – Sathya

関連する問題