2016-03-22 5 views
0

私はAndroid React-NativeアプリでAuth0 Lockを使用しようとしています。私は、セットアップ手順hereに従ったが、私は建物の上に次のエラーを取得する:ReactネイティブAndroidでAuth0ロックでビルドできません

file:/Users/m/git/this-or-that-app/node_modules/react-native/android/com/auth0/android/lock-react-native/maven-metadata.xml 
file:/Users/m/git/this-or-that-app/node_modules/react-native/android/com/auth0/android/lock-react-native/ 

私はこれをインストールする必要があり、そこから適切な場所であることを直感を持っている:私はこれらの行に気づく

FAILURE: Build failed with an exception. 

* What went wrong: 
A problem occurred configuring project ':app'. 
> Could not resolve all dependencies for configuration ':app:_debugCompile'. 
    > Could not find any matches for com.auth0.android:lock-react-native:+ as no versions of com.auth0.android:lock-react-native are available. 
    Searched in the following locations: 
     file:/Users/m/.m2/repository/com/auth0/android/lock-react-native/maven-metadata.xml 
     file:/Users/m/.m2/repository/com/auth0/android/lock-react-native/ 
     https://jcenter.bintray.com/com/auth0/android/lock-react-native/maven-metadata.xml 
     https://jcenter.bintray.com/com/auth0/android/lock-react-native/ 
     file:/Users/m/git/this-or-that-app/node_modules/react-native/android/com/auth0/android/lock-react-native/maven-metadata.xml 
     file:/Users/m/git/this-or-that-app/node_modules/react-native/android/com/auth0/android/lock-react-native/ 
     file:/usr/local/opt/android-sdk/extras/android/m2repository/com/auth0/android/lock-react-native/maven-metadata.xml 
     file:/usr/local/opt/android-sdk/extras/android/m2repository/com/auth0/android/lock-react-native/ 
    Required by: 
     thisOrThatApp:app:unspecified 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

Total time: 16.332 secs 
Could not install the app on the device, read the error above for details. 
Make sure you have an Android emulator running or a device connected and have 
set up your Android development environment: 
https://facebook.github.io/react-native/docs/android-setup.html 

node_modulesフォルダですが、反応ネイティブ・ロック・アンドロイドの内部を見る必要があるときには、ネイティブ・モジュールが反応ネイティブ・モジュールの内部を見ています。これは、グラデル構成の問題かもしれません。どのようにこれを修正するためのヒント?

答えて

1

Auth0サイトのreact-native-androidのドキュメントが古くなっています。 githubレポの設定手順:https://github.com/auth0/react-native-lock-androidを使用してください。

しかし、Repoはまだ古くて、MainActivity.javaの変更方法については完全にはっきりしていません。だから、後でこの記事に来る人のために、私のMainActivity.javaファイルがあります:

package com.thisorthatapp; 

import com.auth0.core.Strategies; 
import com.auth0.facebook.FacebookIdentityProvider; 
import com.auth0.lock.react.LockReactPackage; 
import com.facebook.react.ReactActivity; 
import com.facebook.react.ReactInstanceManager; 
import com.facebook.react.ReactPackage; 
import com.facebook.react.shell.MainReactPackage; 

import java.util.Arrays; 
import java.util.List; 

public class MainActivity extends ReactActivity { 

    /** 
    * Returns the name of the main component registered from JavaScript. 
    * This is used to schedule rendering of the component. 
    */ 
    @Override 
    protected String getMainComponentName() { 
     return "thisOrThatApp"; 
    } 

    /** 
    * Returns whether dev mode should be enabled. 
    * This enables e.g. the dev menu. 
    */ 
    @Override 
    protected boolean getUseDeveloperSupport() { 
     return BuildConfig.DEBUG; 
    } 

    /** 
    * A list of packages used by the app. If the app uses additional views 
    * or modules besides the default ones, add more packages here. 
    */ 
    @Override 
    protected List<ReactPackage> getPackages() { 
     LockReactPackage lockReactPackage = new LockReactPackage(); 
     lockReactPackage.addIdentityProvider(Strategies.Facebook, new FacebookIdentityProvider(this)); 
     return Arrays.<ReactPackage>asList(
      new MainReactPackage(), 
      lockReactPackage 
     ); 
    } 
}