zzyyppqq / react-native-segmented-android

a high imitation of iOS segmented Controls
30 stars 16 forks source link

This module looking for react-native v1.0.1 #1

Open shercoder opened 8 years ago

shercoder commented 8 years ago

I followed your instructions to install the package but I ran into a problem where the error message is saying that it is expecting react-native version to be 1.0.1 but the latest on RN is 0.17.0.

$ npm install react-native-segmented-android --save
npm WARN saveError Problems were encountered
npm WARN saveError Please correct and try again.
npm WARN saveError peer invalid: react-native@^1.0.1, required by react-native-segmented-android@1.0.3
MyProject@0.0.1 /Users/shercoder/workplace/myproject
├── UNMET PEER DEPENDENCY react-native@0.17.0
└── react-native-segmented-android@1.0.3

npm WARN EPEERINVALID react-native-segmented-android@1.0.3 requires a peer of react-native@^1.0.1 but none was installed.

However, it still ended up installing the package in node_modules

tree node_modules/react-native-segmented-android
node_modules/react-native-segmented-android
├── AndroidSegmented.js
├── README.md
├── art
│   ├── segment_1.png
│   └── segment_2.png
├── build.gradle
├── package.json
├── proguard-rules.pro
├── react-native-segmented-android.iml
└── src
    └── main
        ├── AndroidManifest.xml
        ├── java
        │   └── com
        │       └── higo
        │           └── zhangyp
        │               └── segmented
        │                   ├── AndroidSegmented.java
        │                   ├── AndroidSegmentedEvent.java
        │                   ├── AndroidSegmentedManager.java
        │                   └── AndroidSegmentedPackage.java
        └── res
            ├── layout
            │   └── radio_button.xml
            └── values
                └── strings.xml

11 directories, 15 files

Then I followed rest of the instructions under Install to add it to my project

// settings.gradle

rootProject.name = 'MyProject'

include ':app', ':react-native-segmented-android'
project(':react-native-segmented-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-segmented-android')
// app/build.gradle
compile project(':react-native-segmented-android')

Then I added the package to my Activity

After this setup I ran ./gradlew clean --stacktrace and got the following error:

Parallel execution is an incubating feature.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Cannot evaluate module react-native-segmented-android : Configuration with name 'default' not found.

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

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
    at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:74)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:487)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:85)
    at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
    at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:129)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:90)
    at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:49)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.api.UnknownProjectException: Cannot evaluate module react-native-segmented-android : Configuration with name 'default' not found.
    at com.android.build.gradle.internal.DependencyManager.ensureConfigured(DependencyManager.java:666)
    at com.android.build.gradle.internal.DependencyManager.resolveDependencyForConfig(DependencyManager.java:235)
    at com.android.build.gradle.internal.DependencyManager.resolveDependencies(DependencyManager.java:135)
    at com.android.build.gradle.internal.TaskManager.resolveDependencies(TaskManager.java:317)
    at com.android.build.gradle.internal.VariantManager$8.call(VariantManager.java:573)
    at com.android.build.gradle.internal.VariantManager$8.call(VariantManager.java:570)
    at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:48)
    at com.android.builder.profile.Recorder$record.call(Unknown Source)
    at com.android.build.gradle.internal.profile.SpanRecorders.record(SpanRecorders.groovy:69)
    at com.android.build.gradle.internal.VariantManager.createVariantData(VariantManager.java:569)
    at com.android.build.gradle.internal.VariantManager.createVariantDataForProductFlavors(VariantManager.java:722)
    at com.android.build.gradle.internal.VariantManager.populateVariantDataList(VariantManager.java:442)
    at com.android.build.gradle.internal.VariantManager.createAndroidTasks(VariantManager.java:258)
    at com.android.build.gradle.BasePlugin$_createAndroidTasks_closure15.doCall(BasePlugin.groovy:483)
    at com.android.build.gradle.BasePlugin$_createAndroidTasks_closure15.doCall(BasePlugin.groovy)
    at com.android.build.gradle.internal.profile.SpanRecorders$2.call(SpanRecorders.groovy:52)
    at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:48)
    at com.android.build.gradle.internal.profile.SpanRecorders.record(SpanRecorders.groovy:54)
    at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.groovy:482)
    at com.android.build.gradle.BasePlugin$_createTasks_closure13_closure17.doCall(BasePlugin.groovy:415)
    at com.android.build.gradle.BasePlugin$_createTasks_closure13_closure17.doCall(BasePlugin.groovy)
    at com.android.build.gradle.internal.profile.SpanRecorders$2.call(SpanRecorders.groovy:52)
    at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:48)
    at com.android.build.gradle.internal.profile.SpanRecorders.record(SpanRecorders.groovy:54)
    at com.android.build.gradle.BasePlugin$_createTasks_closure13.doCall(BasePlugin.groovy:414)
    at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
    at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
    at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:87)
    at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)
    at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
    at com.sun.proxy.$Proxy10.afterEvaluate(Unknown Source)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
    ... 41 more
Caused by: org.gradle.api.artifacts.UnknownConfigurationException: Configuration with name 'default' not found.
    at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.createNotFoundException(DefaultConfigurationContainer.java:81)
    at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:210)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getByName(DefaultConfigurationContainer.java:71)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getByName(DefaultConfigurationContainer.java:34)
    at org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency.getProjectConfiguration(DefaultProjectDependency.java:69)
    at org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency_Decorated.getProjectConfiguration(Unknown Source)
    at com.android.build.gradle.internal.DependencyManager.ensureConfigured(DependencyManager.java:664)
    ... 72 more

BUILD FAILED

Total time: 1.132 secs
melihmucuk commented 8 years ago

+1

shercoder commented 8 years ago

@melihmucuk I have made a PR fixing the above issue. Meanwhile this is sitting in PR, you are welcome to use my fix from forked repo. Add the following line under dependencies in package.json of your project:

...
"dependencies": {
    "react-native-segmented-android": "github:shercoder/react-native-segmented-android#d1ac24b",
}

Then run npm install. :-)

techmentormaria commented 8 years ago

+1 still doesn't work for me. any updates on this?