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

Error when building for Android after following SDK setup tutorial #56

Closed
lifenautjoe opened this issue Jan 31, 2019 · 7 comments
Closed

Comments

@lifenautjoe
Copy link

Description:
After following every step, to the letter of the Official SDK Setup, when running

flutter build apk --release

The job fails with

Initializing gradle...                                       1.0s
Resolving dependencies...
* Error running Gradle:
ProcessException: Process
"/Users/lifenautjoe/Documents/code/openbook/openbook-app/android/gradlew" exited
abnormally:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not get unknown property 'android' for root project 'android' of type
org.gradle.api.Project.

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

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
  Command:
  /Users/lifenautjoe/Documents/code/openbook/openbook-app/android/gradlew
  app:properties


Please review your Gradle project setup in the android/ folder.

I'm pretty confident the error might be in the block that is asked to be appended to the top of the gradle file shown below

buildscript {
    repositories {
        // ...
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
    }
    dependencies {
        // ...
        // OneSignal-Gradle-Plugin
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.2, 0.99.99]'
    }
}

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

Environment

@Nightsd01
Copy link
Contributor

@lifenautjoe interesting, could you post your pubspec.yaml? It’s likely a conflict with another dependency

@lifenautjoe
Copy link
Author

Hi Brad, thanks for the quick reply. Bashing my head for the last couple of hours on these ones.

Here it is

name: Openbook
description: Social Network

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org.
version: 0.0.1

environment:
  sdk: ">=2.0.0-dev.68.0 <3.0.0"

dependencies:
  onesignal: ^1.0.5
  flutter_advanced_networkimage: ^0.3.13
  dcache: ^0.1.0
  validators: ^1.0.0+1
  url_launcher: ^4.0.1
  uni_links: ^0.1.4
  flutter_slidable: "^0.4.9"
  flutter_cache_manager: ^0.2.0+1
  cached_network_image: ^0.5.0+1
  timeago: ^2.0.9
  loadmore: ^1.0.2
  pigment: ^1.0.3
  photo_view: ^0.1.0
  flushbar: ^1.1.2
  flutter_secure_storage: ^3.1.2
  mime: ^0.9.6+2
  http: ^0.12.0
  intl: ^0.15.7
  rxdart: ^0.18.1
  video_player:
    git:
      url: https://github.com/recastrodiaz/plugins.git
      path: packages/video_player
      ref: d589ee54ce405e38ebc42b1961e54273cd375726
    version: ^0.8.0
  sprintf: "^4.0.0"
  image_picker: ^0.4.10
  image_cropper: ^0.0.6
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_launcher_icons: "^0.6.1"

flutter_icons:
  android: true
  ios: true
  image_path: "assets/images/icon.png"
  adaptive_icon_background: "#FFFFFFFF"
  adaptive_icon_foreground: "assets/images/icon-adaptive-foreground.png"

# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/images/theme-previews/theme-preview-dark.png
    - assets/images/theme-previews/theme-preview-colorful.png
    - assets/images/theme-previews/theme-preview-dark-gold.png
    - assets/images/theme-previews/theme-preview-white.png
    - assets/images/theme-previews/theme-preview-white-gold.png
    - assets/images/splash-background.png
    - assets/images/openbook-o-logo.png
    - assets/images/pixel-universe.jpg
    - assets/images/confetti-background.gif
    - assets/images/avatar.jpg
    - assets/images/cover.jpg
    - assets/lang/es.json
    - assets/lang/en.json
    - assets/images/icons/gif-icon.png
    - assets/images/icons/profile-icon.png
    - assets/images/icons/connections-icon.png
    - assets/images/icons/burner-icon.png
    - assets/images/icons/settings-icon.png
    - assets/images/icons/help-icon.png
    - assets/images/icons/thinking.gif
    - assets/images/icons/customize-icon.png
    - assets/images/icons/logout-icon.png
    - assets/images/icons/audience-icon.png
    - assets/images/icons/home-icon.png
    - assets/images/icons/notifications-icon.png
    - assets/images/icons/search-icon.png
    - assets/images/icons/communities-icon.png
    - assets/images/icons/create-post-icon.png
    - assets/images/icons/chat-icon.png
    - assets/images/icons/photo-icon.png
    - assets/images/icons/video-icon.png
    - assets/images/icons/warning-icon.png
    - assets/images/icons/success-icon.png
    - assets/images/icons/error-icon.png
    - assets/images/icons/info-icon.png
    - assets/images/icons/comments-icon.png
    - assets/images/icons/comment-icon.png
    - assets/images/icons/react-icon.png
    - assets/images/icons/like-icon.png
    - assets/images/icons/finish-icon.png
    - assets/images/icons/finish-icon.png
    - assets/images/icons/load-more-posts-icon.gif
    - assets/images/loading.gif
    - assets/images/stickers/female-instructor.png
    - assets/images/stickers/got-it.png
    - assets/images/stickers/owl-instructor.png
    - assets/images/stickers/perplexed-owl.png
    - .env.json

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.io/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.io/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  fonts:
    - family: NunitoSans
      fonts:
        - asset: assets/fonts/NunitoSans-Regular.ttf
          style: normal
        - asset: assets/fonts/NunitoSans-Bold.ttf
          style: italic
    - family: VisbyRoundCF
      fonts:
        - asset: assets/fonts/VisbyRoundCF-Regular.otf
          style: normal
        - asset: assets/fonts/VisbyRoundCF-Bold.otf
          style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.io/custom-fonts/#from-packages

@Nightsd01
Copy link
Contributor

@lifenautjoe are you sure you added the Gradle plugin to app/build.gradle? Unfortunately Android’s Gradle system is somewhat convoluted and has several Gradle files

@lifenautjoe
Copy link
Author

lifenautjoe commented Jan 31, 2019

Hi Brad,

Nope. I added it to the android/build.gradle as stated in the tutorial.

Add the following to the very top (Line:1 ) of your android/build.gradle

I've now changed it and it builds successfully.

Huge thanks! Hoping there's something similar in the iOS case 🤞 . ( #57 )

P.S. Maybe an idea to update the website? 😅

@Nightsd01
Copy link
Contributor

@jkasten2 can we update the docs for the Flutter SDK to fix the path for android/app/build.gradle, then close this issue? It currently just shows android/build.gradle

@lifenautjoe glad to see it works in android!

@esthrim
Copy link

esthrim commented Feb 8, 2019

@Nightsd01 I think the documentation in OneSignal's site needs to be updated, because until now the version still using 1.0.0

@jkasten2
Copy link
Member

@esthrim Thanks for point that out. It does include a carrot ^ so it will use at least version 1.0.0 but will user a newer version if available. However we just updated our docs to 1.1.0 so an there isn't a chance of an older cached version being used.

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

4 participants