Buglife / react-native-buglife

A React Native wrapper for Buglife
MIT License
12 stars 12 forks source link

appcompat dependency #4

Closed ACCTFORGH closed 6 years ago

ACCTFORGH commented 6 years ago

Encountered the following errors while compiling. I wasn't able to add appcompat V27 to the package dependency because RN Android default compile SDK version is 23. Is V27 really necessary for the package to work?

Error:Failed to resolve: com.android.support:appcompat-v7:27.0.0 Error:Failed to resolve: com.android.support:design:27.0.0 Error:Failed to resolve: com.android.support:support-dynamic-animation:27.0.0

danhd123 commented 6 years ago

Hi @ACCTFORGH, while V27 is not strictly necessary, APIs we use were added in API 25 and 26, and targeting the latest SDK is generally good practice. Is there a particular reason you can't upgrade your compileSdkVersion and targetSdkVersion? Buglife will run (albeit with reduced features) back to SDK 15.

We can add a note in the README that you may need to set the compile and target sdk versions.

schukin commented 6 years ago

Hi @ACCTFORGH, just wanted to check in and see if you were still having issues with this?

ACCTFORGH commented 6 years ago

Thanks for checking in. I'll test today and see if it has any issue increasing the compile SDK version.

Thank you.

Regards, Zijie (ZJ) Lin

On Tue, Jan 9, 2018 at 11:14 AM, Dave Schukin notifications@github.com wrote:

Hi @ACCTFORGH https://github.com/acctforgh, just wanted to check in and see if you were still having issues with this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Buglife/react-native-buglife/issues/4#issuecomment-356186647, or mute the thread https://github.com/notifications/unsubscribe-auth/AJGIzGSaJ8k3mzrbObyn4172Ir95rIaxks5tIvyygaJpZM4RUtwp .

ArnaudRinquin commented 6 years ago

I have the exact same issue after (re)installing rn-buglife.

I changed updated my compile SDK version to 27 (v27.0.1) but then I get these errors:

screen shot 2018-01-09 at 11 08 04

Here is my diff

diff --git a/mobile/android/app/build.gradle b/mobile/android/app/build.gradle
index 8f2eb30c7..71c511253 100644
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -103,12 +103,12 @@ android {
             storePassword 'pockmark-herdsman-mastodon-theorize'
         }
     }
-    compileSdkVersion 23
+    compileSdkVersion 27
     buildToolsVersion '27.0.1'
     defaultConfig {
         applicationId "com.slite.mobile"
         minSdkVersion 16
-        targetSdkVersion 22
+        targetSdkVersion 27
         versionCode 3
         versionName "1.0-alpha3"
         ndk {
@@ -146,6 +146,7 @@ android {
 }

 dependencies {
+    compile project(':react-native-buglife')
     compile project(':react-native-config')
     compile fileTree(include: ['*.jar'], dir: 'libs')
     compile 'com.android.support:appcompat-v7:23.0.1'
diff --git a/mobile/android/app/src/main/java/com/slite/mobile/MainApplication.java b/mobile/android/app/src/main/java/com/slite/mobile/MainApplication.java
index e0c1d4e8a..2fe8c1adc 100644
--- a/mobile/android/app/src/main/java/com/slite/mobile/MainApplication.java
+++ b/mobile/android/app/src/main/java/com/slite/mobile/MainApplication.java
@@ -3,6 +3,7 @@ package com.slite.mobile;
 import android.app.Application;

 import com.facebook.react.ReactApplication;
+import com.buglife.BuglifeModule;
 import com.lugg.ReactNativeConfig.ReactNativeConfigPackage;
 import com.facebook.react.ReactNativeHost;
 import com.facebook.react.ReactPackage;
@@ -24,6 +25,7 @@ public class MainApplication extends Application implements ReactApplication {
     protected List<ReactPackage> getPackages() {
       return Arrays.<ReactPackage>asList(
           new MainReactPackage(),
+            BuglifeModule.getPackage(),
             new ReactNativeConfigPackage()
       );
     }
diff --git a/mobile/android/build.gradle b/mobile/android/build.gradle
index 03de1f72a..cbca4c0d4 100644
--- a/mobile/android/build.gradle
+++ b/mobile/android/build.gradle
@@ -16,6 +16,7 @@ allprojects {
     repositories {
         mavenLocal()
         jcenter()
+        google()
         maven {
             // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
             url "$rootDir/../node_modules/react-native/android"
diff --git a/mobile/android/settings.gradle b/mobile/android/settings.gradle
index 92157a8c3..6839d0370 100644
--- a/mobile/android/settings.gradle
+++ b/mobile/android/settings.gradle
@@ -1,4 +1,6 @@
 rootProject.name = 'mobile'
+include ':react-native-buglife'
+project(':react-native-buglife').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-buglife/android')
 include ':react-native-config'
 project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android')

diff --git a/mobile/ios/mobile.xcodeproj/project.pbxproj b/mobile/ios/mobile.xcodeproj/project.pbxproj
index 1c586ddff..96752480b 100644
--- a/mobile/ios/mobile.xcodeproj/project.pbxproj
+++ b/mobile/ios/mobile.xcodeproj/project.pbxproj
@@ -28,6 +28,7 @@
        75423BA51FE7F0320067E36B /* StoryboardLoadable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75423BA31FE7F0320067E36B /* StoryboardLoadable.swift */; };
        75DDDF3E1FE823CE000FF4BE /* EditorManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 75DDDF3D1FE823CE000FF4BE /* EditorManager.m */; };
        832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
+       84B8FCC013284AF9AF781228 /* libRNBuglife.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 60A54906E3FB4FD4ACB4E52F /* libRNBuglife.a */; };
        ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
        B659B1835C8FC6B12FDB8604 /* Pods_mobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C0E6134B5089777BF81D404 /* Pods_mobile.framework */; };
        C5DEE922967E4B9FB29CC1AC /* libReactNativeConfig.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E0DBD8C55954D80895320F4 /* libReactNativeConfig.a */; };
@@ -232,6 +233,13 @@
            remoteGlobalIDString = 3DBE0D0D1F3B181C0099AA32;
            remoteInfo = "fishhook-tvOS";
        };
+       51836E79200542A8006A8A9F /* PBXContainerItemProxy */ = {
+           isa = PBXContainerItemProxy;
+           containerPortal = 22D62F1E28E54870927F5813 /* RNBuglife.xcodeproj */;
+           proxyType = 2;
+           remoteGlobalIDString = 134814201AA4EA6300B7C361;
+           remoteInfo = RNBuglife;
+       };
        51C447131FD052CC0081AC85 /* PBXContainerItemProxy */ = {
            isa = PBXContainerItemProxy;
            containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
@@ -331,12 +339,14 @@
        13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = mobile/Info.plist; sourceTree = "<group>"; };
        13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = mobile/main.m; sourceTree = "<group>"; };
        146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
+       22D62F1E28E54870927F5813 /* RNBuglife.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNBuglife.xcodeproj; path = "../node_modules/react-native-buglife/ios/RNBuglife.xcodeproj"; sourceTree = "<group>"; };
        24311AFED6B34B2D9A9BBDBD /* Geomanist-Medium.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Geomanist-Medium.ttf"; path = "../assets/fonts/Geomanist-Medium.ttf"; sourceTree = "<group>"; };
        2831E740856ABDB9DF47FC45 /* Pods-mobile.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-mobile.release.xcconfig"; path = "Pods/Target Support Files/Pods-mobile/Pods-mobile.release.xcconfig"; sourceTree = "<group>"; };
        3625723E5DE3523EFD5F9444 /* Pods-mobile-tvOSTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-mobile-tvOSTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-mobile-tvOSTests/Pods-mobile-tvOSTests.debug.xcconfig"; sourceTree = "<group>"; };
        510A25BB1FE932B10020F05A /* ART.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ART.xcodeproj; path = "../node_modules/react-native/Libraries/ART/ART.xcodeproj"; sourceTree = "<group>"; };
        518E450F1FFDCFBF00E9C718 /* mobile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = mobile.entitlements; path = mobile/mobile.entitlements; sourceTree = "<group>"; };
        5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
+       60A54906E3FB4FD4ACB4E52F /* libRNBuglife.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNBuglife.a; sourceTree = "<group>"; };
        64C92C5814F88EDF1E85423C /* Pods_mobileTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_mobileTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
        6E0DBD8C55954D80895320F4 /* libReactNativeConfig.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libReactNativeConfig.a; sourceTree = "<group>"; };
        7536AA501FE8217300CDF7A3 /* EditorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = EditorView.swift; path = mobile/Editor/EditorView.swift; sourceTree = "<group>"; };
@@ -387,6 +397,7 @@
                139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
                C5DEE922967E4B9FB29CC1AC /* libReactNativeConfig.a in Frameworks */,
                B659B1835C8FC6B12FDB8604 /* Pods_mobile.framework in Frameworks */,
+               84B8FCC013284AF9AF781228 /* libRNBuglife.a in Frameworks */,
            );
            runOnlyForDeploymentPostprocessing = 0;
        };
@@ -526,7 +537,7 @@
            isa = PBXGroup;
            children = (
                6E0DBD8C55954D80895320F4 /* libReactNativeConfig.a */,
-               3AE5CAD2037A43798097E70B /* libRNBuglife.a */,
+               60A54906E3FB4FD4ACB4E52F /* libRNBuglife.a */,
            );
            name = "Recovered References";
            sourceTree = "<group>";
@@ -548,6 +559,14 @@
            name = Products;
            sourceTree = "<group>";
        };
+       51836E76200542A8006A8A9F /* Products */ = {
+           isa = PBXGroup;
+           children = (
+               51836E7A200542A8006A8A9F /* libRNBuglife.a */,
+           );
+           name = Products;
+           sourceTree = "<group>";
+       };
        5E91572E1DD0AC6500FF2AA8 /* Products */ = {
            isa = PBXGroup;
            children = (
@@ -601,6 +620,7 @@
                00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
                139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
                A5FD11C092094D08BFA6997A /* ReactNativeConfig.xcodeproj */,
+               22D62F1E28E54870927F5813 /* RNBuglife.xcodeproj */,
            );
            name = Libraries;
            sourceTree = "<group>";
@@ -811,6 +831,10 @@
                    ProductGroup = 5102B1D91FD081B100477172 /* Products */;
                    ProjectRef = A5FD11C092094D08BFA6997A /* ReactNativeConfig.xcodeproj */;
                },
+               {
+                   ProductGroup = 51836E76200542A8006A8A9F /* Products */;
+                   ProjectRef = 22D62F1E28E54870927F5813 /* RNBuglife.xcodeproj */;
+               },
            );
            projectRoot = "";
            targets = (
@@ -1010,6 +1034,13 @@
            remoteRef = 517A4CC61FD04F6A0015A21C /* PBXContainerItemProxy */;
            sourceTree = BUILT_PRODUCTS_DIR;
        };
+       51836E7A200542A8006A8A9F /* libRNBuglife.a */ = {
+           isa = PBXReferenceProxy;
+           fileType = archive.ar;
+           path = libRNBuglife.a;
+           remoteRef = 51836E79200542A8006A8A9F /* PBXContainerItemProxy */;
+           sourceTree = BUILT_PRODUCTS_DIR;
+       };
        51C447141FD052CC0081AC85 /* libthird-party.a */ = {
            isa = PBXReferenceProxy;
            fileType = archive.ar;
@@ -1288,12 +1319,14 @@
                HEADER_SEARCH_PATHS = (
                    "$(inherited)",
                    "$(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig",
+                   "$(SRCROOT)/../node_modules/react-native-buglife/ios/**",
                );
                INFOPLIST_FILE = mobileTests/Info.plist;
                IPHONEOS_DEPLOYMENT_TARGET = 8.0;
                LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
                LIBRARY_SEARCH_PATHS = (
                    "$(inherited)",
+                   "\"$(SRCROOT)/$(TARGET_NAME)\"",
                );
                OTHER_LDFLAGS = (
                    "-ObjC",
@@ -1323,12 +1356,14 @@
                HEADER_SEARCH_PATHS = (
                    "$(inherited)",
                    "$(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig",
+                   "$(SRCROOT)/../node_modules/react-native-buglife/ios/**",
                );
                INFOPLIST_FILE = mobileTests/Info.plist;
                IPHONEOS_DEPLOYMENT_TARGET = 8.0;
                LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
                LIBRARY_SEARCH_PATHS = (
                    "$(inherited)",
+                   "\"$(SRCROOT)/$(TARGET_NAME)\"",
                );
                OTHER_LDFLAGS = (
                    "-ObjC",
@@ -1358,6 +1393,7 @@
                HEADER_SEARCH_PATHS = (
                    "$(inherited)",
                    "$(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig",
+                   "$(SRCROOT)/../node_modules/react-native-buglife/ios/**",
                );
                INFOPLIST_FILE = mobile/Info.plist;
                LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -1392,6 +1428,7 @@
                HEADER_SEARCH_PATHS = (
                    "$(inherited)",
                    "$(SRCROOT)/../node_modules/react-native-config/ios/ReactNativeConfig",
+                   "$(SRCROOT)/../node_modules/react-native-buglife/ios/**",
                );
                INFOPLIST_FILE = mobile/Info.plist;
                LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
diff --git a/mobile/ios/mobile.xcodeproj/project.xcworkspace/xcuserdata/arnaud.xcuserdatad/UserInterfaceState.xcuserstate b/mobile/ios/mobile.xcodeproj/project.xcworkspace/xcuserdata/arnaud.xcuserdatad/UserInterfaceState.xcuserstate
index 3bdba00c5..38bc420c6 100644
Binary files a/mobile/ios/mobile.xcodeproj/project.xcworkspace/xcuserdata/arnaud.xcuserdatad/UserInterfaceState.xcuserstate and b/mobile/ios/mobile.xcodeproj/project.xcworkspace/xcuserdata/arnaud.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/mobile/ios/mobile/Info.plist b/mobile/ios/mobile/Info.plist
index 4d26fd365..2772850a9 100644
--- a/mobile/ios/mobile/Info.plist
+++ b/mobile/ios/mobile/Info.plist
@@ -40,7 +40,9 @@
        </dict>
    </dict>
    <key>NSLocationWhenInUseUsageDescription</key>
-   <string></string>
+   <string/>
+   <key>NSPhotoLibraryAddUsageDescription</key>
+   <string>To attach a photo to bug reports, we need to access your photo library.</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>You can send us feedback easily by taking screen captures</string>
    <key>UIAppFonts</key>
diff --git a/mobile/package.json b/mobile/package.json
index 3f22587c0..d992b48e6 100644
--- a/mobile/package.json
+++ b/mobile/package.json
@@ -36,6 +36,7 @@
     "qs": "^6.5.1",
     "react": "16.0.0",
     "react-native": "0.50.4",
+    "react-native-buglife": "^0.1.5",
     "react-native-config": "^0.9.0",
     "react-native-side-menu": "^1.1.3",
     "react-native-typography": "^1.0.3",
diff --git a/mobile/src/root/index.js b/mobile/src/root/index.js
index f6f41ce95..4c3506902 100644
--- a/mobile/src/root/index.js
+++ b/mobile/src/root/index.js
@@ -3,15 +3,15 @@ import React, { Component } from 'react'
 import I18n from './I18n'
 import Redux from './Redux'
 import { getApiClient } from '../remote'
-// import Buglife from 'react-native-buglife'
+import Buglife from 'react-native-buglife'

 console.ignoredYellowBox = ['Remote debugger'] // silence that damn warning

 export default class Root extends Component {
-  // componentDidMount() {
-  //   Buglife.startWithEmail(this.props.config.buglifeApiKey)
-  //   Buglife.setInvocationOptions(Buglife.invocationOptionsScreenshot)
-  // }
+  componentDidMount() {
+    Buglife.startWithEmail(this.props.config.buglifeApiKey)
+    Buglife.setInvocationOptions(Buglife.invocationOptionsScreenshot)
+  }

   render() {
     const { config, children } = this.props
diff --git a/mobile/yarn.lock b/mobile/yarn.lock
index 321d4c242..489750083 100644
--- a/mobile/yarn.lock
+++ b/mobile/yarn.lock
@@ -5844,6 +5844,10 @@ react-modal@^3.1.4:
     prop-types "^15.5.10"
     warning "^3.0.0"

+react-native-buglife@^0.1.5:
+  version "0.1.5"
+  resolved "https://registry.yarnpkg.com/react-native-buglife/-/react-native-buglife-0.1.5.tgz#7cf808b43a435c4138c6d3e4562831ac8059bb3c"
+
 react-native-compat@^1.0.0:
   version "1.0.0"
   resolved "https://registry.yarnpkg.com/react-native-compat/-/react-native-compat-1.0.0.tgz#491dbd8a0105ac061b8d0d926463ce6a3dff33bc"
schukin commented 6 years ago

Thanks @ArnaudRinquin, we've got all hands on deck for this. I'll follow up ASAP.

danhd123 commented 6 years ago

Hi @ArnaudRinquin, when you update your compileSdkVersion and targetSdkVersion, you also need to update your appcompat libraries' versions to the same major version. compile 'com.android.support:appcompat-v7:23.0.1' --> 27.0.0 (or whichever the current version is) See here for more info.

Note that you may have multiple appcompat libraries as dependencies.

juanamd commented 6 years ago

Same issue here. Already upgraded all the required lines to 27:

compileSdkVersion 27 buildToolsVersion "27.0.2" targetSdkVersion 27 com.android.support:appcompat-v7:27.0.2

Still the same error. However, I should point out that there must be a valid reason why React Native has not upgraded to a newer SDK version yet. So I don't think it is a good idea for this library to require the latest SDK, even more so if it is not strictly necessary.

ArnaudRinquin commented 6 years ago

@danhd123 I've done it without success, I still have the same issue + incompatibilities warnings if I try to change the com.android.support:accompat version to 27.

schukin commented 6 years ago

Quick update: This does indeed look to be an issue w/ react-native-buglife (thanks everyone for pointing this out, ha). We're currently looking into a fix, and will update here shortly.

schukin commented 6 years ago

Hey folks - This issue is now resolved in react-native-buglife v0.1.7.

Just one additional step to upgrade: You'll need to update your compileSdkVersion to 26 (along with any appcompat libraries that your app is using).

@juanamd made an interesting point about React Native having not yet upgraded to a newer SDK version; however that is simply the template that RN creates. Other RN native libaries, such as Lottie, will require developers to upgrade to compileSdkVersion 26. Note that you can still leave your targetSdkVersion lower.

Thanks everyone for the help in uncovering this issue! Please drop a comment in this thread if you experience any other related issues (or feel free to file a new GitHub issue). Getting this to be a smooth experience is our top priority at the moment.

ArnaudRinquin commented 6 years ago

While the Android build now works, I have multiple issues:

  1. On iOS, it fails to build with many errors on this pattern:

    duplicate symbol _OBJC_METACLASS_$_LIFEStepsToReproTableViewController in: /Users/arnaud/projects/slite/mobile/ios/Pods/Buglife/Buglife.framework/Buglife(LIFEStepsToReproTableViewController.o)
    /Users/arnaud/Library/Developer/Xcode/DerivedData/mobile-dyldqhcjzhtrmbaaxlhdnidkutey/Build/Products/Debug-iphonesimulator/libRNBuglife.a(LIFEStepsToReproTableViewController.o)
  2. Once the Android build runs, I have the following error when at Buglife initialization step:

    Unable to call method `startWithEmail` of `undefined`.

    It seems that import Buglife from 'react-native-buglife returns undefined.

schukin commented 6 years ago

Hey @ArnaudRinquin -

  1. React Native changed the way you’re supposed to integrate native libraries within the couple months, and it looks like you have Buglife-iOS installed twice (this is partially our fault as well). Remove pod Buglife from your Podfile, run pod install and that should fix the issue.

  2. We’re looking into this one! 😬

schukin commented 6 years ago

Okay folks, it looks like we had an issue where either the iOS native module, or the Android native module would fail to import, depending on how they were imported in code (require vs import).

We've just released v0.1.8, which resolves this issue. We've also added an example app that demonstrates basic functionality.

Apologies again for the trouble, and thank you all for helping us debug this!