rafaellincoln / react-native-telephony

Android Telephony for React Native
https://www.npmjs.com/package/react-native-telephony
MIT License
34 stars 13 forks source link

Unable to find a matching configuration of project :react-native-telephony: #18

Open Makgora opened 4 years ago

Makgora commented 4 years ago

Hi !

I just installed the lib using:

npm install --save react-native-telephony

Then I tried to build my app:

npm run android

And I get this error :

FAILURE: Build failed with an exception.

  • What went wrong: Could not determine the dependencies of task ':app:preDebugBuild'. Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. Could not resolve project :react-native-telephony. Required by: project :app Unable to find a matching configuration of project :react-native-telephony:
    • None of the consumable configurations have attributes.

I tried to link with

npm link react-native-telephony

I updtated settings.gradle file:

rootProject.name = 'app'

include ':react-native-telephony'
project(':react-native-telephony').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-telephony/android')

apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

include ':app

I updtated build.gradle file:

implementation project(':react-native-telephony')

And MainApplication.java :

import com.telephony.TelephonyPackage;
...
@Override
        protected List<ReactPackage> getPackages() {
          @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
          // Packages that cannot be autolinked yet can be added manually here, for example:
          // packages.add(new MyReactNativePackage());
            packages.add(new TelephonyPackage());
          return packages;
        }

What can I try ? Is this a problem someone already faced ?

yusufdonmez commented 4 years ago

npm install --save react-native-telephony npx react-native run-android

ip883 commented 2 years ago

I know it's an old thread but to help ppl who are stuck with this:

In android/settings.gradle I added

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

right before

include ':app'

at the end of the file. That fixed the problem for me.

Kayre-Scott-Primon commented 2 years ago

Hi, i'm having the same problem, any suggestion to solve this?