Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New instalation not working #55

Open
iesteban opened this issue Feb 16, 2017 · 9 comments
Open

New instalation not working #55

iesteban opened this issue Feb 16, 2017 · 9 comments

Comments

@iesteban
Copy link

I just followed the React Native getting started section (code on https://github.com/Semillas/semillas_react_native)

I followed the this repo's README and it's not working. This is the resulting code. And this is the diff of what I add for using react-native-fabric-digits.

The error I'm getting when running react-native run-android is the following:

        :app:generateDebugSources
        :app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
        :app:compileDebugJavaWithJavac
        :app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
        /home/ismael/branches/Semillas/android/app/src/main/java/com/semillas/MainApplication.java:6: error: cannot find symbol
        import com.facebook.react.ReactApplication;
                                 ^
          symbol:   class ReactApplication
          location: package com.facebook.react
        /home/ismael/branches/Semillas/android/app/src/main/java/com/semillas/MainApplication.java:8: error: cannot find symbol
        import com.facebook.react.ReactNativeHost;
                                 ^
          symbol:   class ReactNativeHost
          location: package com.facebook.react
        /home/ismael/branches/Semillas/android/app/src/main/java/com/semillas/MainApplication.java:18: error: cannot find symbol
        public class MainApplication extends Application implements ReactApplication {
                                                                    ^
          symbol: class ReactApplication
        /home/ismael/branches/Semillas/android/app/src/main/java/com/semillas/MainApplication.java:20: error: cannot find symbol
          private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                        ^
          symbol:   class ReactNativeHost
          location: class MainApplication
        /home/ismael/branches/Semillas/android/app/src/main/java/com/semillas/MainApplication.java:36: error: cannot find symbol
          public ReactNativeHost getReactNativeHost() {
                 ^
          symbol:   class ReactNativeHost
          location: class MainApplication
        /home/ismael/branches/Semillas/android/app/src/main/java/com/semillas/MainActivity.java:5: error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActiv
        ity
        public class MainActivity extends ReactActivity {
               ^
        /home/ismael/branches/Semillas/android/app/src/main/java/com/semillas/MainApplication.java:20: error: cannot find symbol
          private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                                                               ^
          symbol:   class ReactNativeHost
          location: class MainApplication
        /home/ismael/branches/Semillas/android/app/src/main/java/com/semillas/MainApplication.java:35: error: method does not override or implement a method from a supertype
          @Override
          ^
        8 errors
        :app:compileDebugJavaWithJavac FAILED

        FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':app:compileDebugJavaWithJavac'.
        > Compilation failed; see the compiler error output for details.

Cheers!

@iesteban
Copy link
Author

It's still not working with Android and an example app created using Ignite on Android.

I believe the problem is that MainActivity.java has been "substituted" by MainApplication.java.

When following the Readme, the content expected to be in MainActivity is not in MainActivity but in MainApplication. So the only option is fill that part in MainApplication.

@brascene
Copy link

@iesteban did you make it work?
If not, provide here content of your .gradle files as well as MainApplication.java.

You're right, there are some things to be corrected or added in Readme. Check these things here: https://fabric.io/kits/android/digits/install

Remember that you must create Twitter app and provide its details to above instructions page, which will generate the rest of code and key/secret.

@iesteban
Copy link
Author

@brascene thanks!
I tried again this week, having the same result.

You can browse the code here: https://github.com/Semillas/SemillasReactNative/tree/digits-reloaded

Regarding to the https://fabric.io/kits/android/digits/install steps, the part of MainActivity.java ... I really don't know where to put it, since in my code I don't have the method onCreate , check out.

I created that application from https://infinite.red/ignite

@brascene
Copy link

@iesteban OK, so:

  • The first thing I've noticed is in your settings.gradle file, you should change this:
    project(':react-native-fabric-digits').projectDir = new File(settingsDir, '../node_modules/react-native-fabric-digits/android') to this (note the bolded)
    project(':react-native-fabric-digits').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fabric-digits/android')

  • Second: this code: classpath 'io.fabric.tools:gradle:1.+ should be placed in android/build.gradle, not in android/app/build.gradle

  • Third: in your AndroidManifest.xml file, you have metadata tag for three things:
    fabric api key
    digit api key
    digit api secret
    That's not good. You need only first tag with fabric, so delete all except this:
    <meta-data android:name="io.fabric.ApiKey" android:value="placeholder" />
    And of course put the real data for io.fabric.ApiKey which you'll obtain from digit installation page.

  • Fourth: Your MainActivity.java file should look like this:
    `

package com.semillasreactnative;

import com.facebook.react.ReactActivity;
import com.proxima.RCTDigits.DigitsPackage;
import com.digits.sdk.android.Digits;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.twitter.sdk.android.core.TwitterAuthConfig;
import io.fabric.sdk.android.Fabric;

import com.twitter.sdk.android.core.TwitterCore;
import com.digits.sdk.android.*;

public class MainActivity extends ReactActivity {

    private static final String TWITTER_KEY = "YourTwitterKey";
    private static final String TWITTER_SECRET = "YourTwitterSecret";

    @Override
    protected String getMainComponentName() {
        return "SemillasReactNative";
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
          Fabric.with(this, new TwitterCore(authConfig), new Digits.Builder().build());
        }
}

That should do it :)

In order to get all keys and secret you have to create an Twitter application. Use those app's details to generate Twitter key/secret for MainActivity.java. To get fabric key for Mainfest.xml file, you need to be registered on Fabric.

@iesteban
Copy link
Author

Thanks a lot!

Yes, I have all the keys, just removed them in order to push to github.

I think i'll try it later today. I'll let you know.

Best!

@iesteban
Copy link
Author

Seems I'm getting over and over the exact same problem:

/home/ismael/branches/SemillasReactNative2/android/app/src/main/java/com/semillasreactnative/MainApplication.java:6: error: cannot find symbol
import com.facebook.react.ReactApplication;
                         ^
  symbol:   class ReactApplication
  location: package com.facebook.react

Don't know if there is something basic I'm not doing.

Thanks a lot!!!!

@brascene
Copy link

Commit your changes so I can check

@iesteban
Copy link
Author

Sure: Semillas/SemillasReactNative@5909cb5

There they are.
I removed again the keys. Don't know if there is a good solution for this kind of keys and open source.

Thanks you!!

@iesteban
Copy link
Author

Hey all,

I implemented every change you suggested @brascene, thank you so much.

My problem got also solved with this change:
Semillas/SemillasReactNative@448cb35#diff-6d2ba47b03176fba78d091d910c43398

Now it's compiling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants