I couldn't deploy my webapp with Android Studio. It gives error com.google.android.gcm.server does not exist
How to solve this problem ? (In eclipse I was able to deploy it easily)
In backend:
import com.google.android.gcm.server.Message;
import com.google.android.gcm.server.MulticastResult;
import com.google.android.gcm.server.Result;
import com.google.android.gcm.server.Sender;
Backend build.gradle:
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.14'
compile 'com.google.appengine:appengine-endpoints:1.9.14'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.14'
compile 'javax.servlet:servlet-api:2.5'
compile 'javax.persistence:persistence-api:1.0'
}
App's build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile project(path: ':backend', configuration: 'android-endpoints')
}
And the error message:
error: package com.google.android.gcm.server does not exist
Add below line to your backend's build.gradle file.
compile 'com.ganyo:gcm-server:1.0.2'
Related
xcode returns this error when I run my app in device (iPhone 6):
WARN: Install the SQLitePorter plugin: 'ionic cordova plugin add
uk.co.workingedge.cordova.plugin.sqliteporter' ERROR:
plugin_not_installed
run this
ionic cordova plugin add uk.co.workingedge.cordova.plugin.sqliteporter
npm install --save #ionic-native/sqlite-porter
and in app.module.ts
import { SQLitePorter } from '#ionic-native/sqlite-porter';
providers: [
SQLitePorter
]
I am working on react native push notification and configuring fcm in my build.gradle file
I am getting error
> Task :react-native-device-info:compileReleaseJavaWithJavac
Note: E:\IOOLABS\Projects\mobeApp\mobeApp\node_modules\react-native-device-info\android\src\main\java\com\learnium\RNDeviceInfo\RNDeviceModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-fcm:compileReleaseJavaWithJavac
Note: E:\IOOLABS\Projects\mobeApp\mobeApp\node_modules\react-native-fcm\android\src\main\java\com\evollu\react\fcm\SendNotificationTask.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-i18n:compileReleaseJavaWithJavac
Note: E:\IOOLABS\Projects\mobeApp\mobeApp\node_modules\react-native-i18n\android\src\main\java\com\AlexanderZaytsev\RNI18n\RNI18nModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-video:compileReleaseJavaWithJavac
Note: E:\IOOLABS\Projects\mobeApp\mobeApp\node_modules\react-native-video\android\src\main\java\com\brentvatne\react\ReactVideoViewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
here it is app/build.gradle configuration
dependencies {
compile project(':react-native-fcm')
compile 'com.google.firebase:firebase-core:10.0.1' //this decides your firebase SDK version
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile project(':react-native-config')
compile project(':react-native-sound')
compile project(':react-native-vector-icons')
compile project(':react-native-video')
compile project(':react-native-file-chooser')
compile project(':react-native-audio')
compile project(':react-native-image-picker')
compile project(':react-native-i18n')
compile project(':react-native-device-info')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.facebook.react:react-native:+'
}
and android build.gradle file is
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// PLEASE DO NOT CHANGE GRADLE VERSION
classpath 'com.google.gms:google-services:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
help me how to resolve it
This is the conflict of android jar library.
It is common error.
You need exclude module or something?
I can't answer your question, because It is few information about your error.
What I want to say is react-native-device-info and react-native-fcm very often conflict!. (the two library use same jar file.)
try search exclude module or force in build.gradle.
And, react-native-firebase is better fcm library than react-native-fcm.
Try it.
Read it!
How to solve Google Play Services version collision in gradle dependencies
https://medium.com/#suchydan/how-to-solve-google-play-services-version-collision-in-gradle-dependencies-ef086ae5c75f
Welcome to React Native!!!
did you try jetify ?
First, use Android Studio's refactoring tool to convert your app re: the Android developer docs
npm install --save-dev jetifier
npx jetify
npx react-native run-android (your app should correctly compile and work)
Call npx jetify run in the postinstall target of your package.json (Any time your dependencies update you have to jetify again)
For more informations :
jetify
I am having a hard time trying to configure my emulator with react native. I already have the emulator installed but can't properly run the statement: react-native run-android this is the error I keep getting. (p.s. there seems to be no solutions in the troubleshoot. I have tried to change the gradle-properties which was ineffective)
C:\Users\Dell\AwesomeProject>react-native run-android
Scanning folders for symlinks in C:\Users\Dell\AwesomeProject\node_modules (31ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
FAILURE: Build failed with an exception.
What went wrong:
Could not determine java version from '10'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
I had the same issue. After upgrading to Ubuntu Bionic which comes with Java 10 which is not supported by react-native.
I'm using the following script now:
#!/bin/bash
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/
export PATH=$JAVA_HOME/bin:$PATH
react-native run-android
I change the env path to Java 8 and run the app.
You can try upgrading your gradle or downgrading java ... I would prefer upgrading your gradle.
Upgrading our Gradle
1 .Modify android/build.gradle :
Add google() inside repositories
buildscript {
repositories {
jcenter()
// add google() here
google()
Update com.android.tools.build.gradle to 3.1.0
buildscript {
repositories {
jcenter()
google()
}
dependencies {
// classpath 'com.android.tools.build:gradle:2.2.3'
// update from 2.2.3 to 3.1.0
classpath 'com.android.tools.build:gradle:3.1.0'
Add google() inside repositories after dependencies :
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
}
allprojects {
repositories {
mavenLocal()
jcenter()
// add googgle() here
google()
Add android.enableAapt2=false to android/gradle.properties
android.enableAapt2=false // < --- add here
android.useDeprecatedNdk=true
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
Update gradle version in android/gradle/wrapper/gradle-wrapper.properties :
// from version 2.14.1
distributionUrl=https://services.gradle.org/distributions/gradle-2.14.1-all.zip
// change to 4.4
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
Runreact-native run-android. (This might take a while since it’ll be downloading the updated gradle version.)
I have Jest+Enzyme setup to test my React app and I use brunch to build the app. When I run brunch, I got following error
Processing of node_modules/enzyme/build/react-compat.js failed. Error: Could not load module 'react/addons' from '/home/Project/node_modules/enzyme/build'. Possible solution: runnpm install.
But I have no trouble running Jest. I use yarn and yarn install does nothing as I have all packages installed. What is this missing react/addons package?
Solved the issue by telling brunch to ignore my test files
conventions: {
ignored: [
'**/*.test.js'
]
}
I created a script in gradle. When I select Run -> External Tools -> External Tools Configurations -> Gradle build for Creating new build and its throwing error An error has occurred.
"See error log for more details.!java.lang.NullPointerException " its displayed in messagebox
After editing build.gradle file same error also displaying! "An internal error occurred during: "Calculating Gradle Tasks...".java.lang.NullPointerException"
apply plugin: 'java'
apply plugin: 'eclipse'
version = "1.0"
sourceCompatibility = 1.7
jar {
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version':
version
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.+'
}
}
repositories {
mavenCentral()
}
sourceSets {
unitTest {
java.srcDir file('src/test/java')
resources.srcDir file('src/test/resources')
}
}
task wrapper(type: Wrapper) {
description = 'Install Gradle wrapper'
gradleVersion = '1.10'
}
dependencies {
compile 'org.apache.poi:poi:3.9'
compile 'org.testng:testng:6.8.5'
compile 'org.seleniumhq.selenium:selenium-server:2.39.0'
compile 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.42.2'
compile 'com.googlecode.json-simple:json-simple:1.1'
compile 'net.sf.json-lib:json-lib:2.4:jdk15'
compile 'log4j:log4j:1.2.17'
}
test {
useTestNG(){
options.suites("src/test/resources/testng.xml")
}
}
uploadArchives {
repositories {
flatDir {
dirs 'repos'
}
}
}
Anything i missed in configuration, anyone can help me?
I have created a Gradle project in Eclipse, and pasted your build.gradle contents into mine.
Your gradle script seems fine to me. I could:
- See Gradle tasks for the project in Gradle Tasks view
- Open Gradle
Build launcher configuration wizard via context menu on the project
explorer and via the Run External Tools
- Could launch Gradle tasks
All that with STS 3.6.0 M1 (latest Gradle Eclipse integration
Which STS are you using? Or which version of Gradle Eclipse integration?
What's the stack trace for the NPE?
Try upgrading your Gradle eclipse integration from this update site: http://dist.springsource.com/release/TOOLS/gradle If that still won't work try the latest, STS 3.6.0 RC1 update site and pick Gradle Eclipse Integration from there http://dist.springsource.com/milestone/TOOLS/update/3.6.0.RC1/e4.4 (replace e4.4 with your eclipse version, e.g. e4.3, e4.2, e3.8, e3.7)