Android Parse Setup - android

I am trying to set up my first parse project however its not going so well. I would think it should be very straight forward however im still having issues and there are no current tutorials on youtube that i can find that work. The latest tutorial i've found for it is 3 years old.
I'm trying to follow the instructions here:
https://docs.parseplatform.org/android/guide/#installation
I've tried it 2 ways.
1) I have downloaded the parse project from github here:
https://github.com/parse-community/Parse-SDK-Android
Downloading this project comes with a lot of extras for this that are currently way over my head like folders for fcm, gcm, and ktx. The parse folder however also comes with a ton of classes.
I've been following tutorials which gave me a template parse project that was already set up however it was mean for android studio 2.2 i believe (Im currently running 3.3) When i would try to upgrade the files, it would give me tons of compatibility errors.
if anyone has any suggestions on how to fix this, i would greatly appreciate it. Here is what I have tried below:
i've followed the instructions in the link above however i get this error:
Could not find method implementation() for
arguments [com.github.parse-community.Parse-SDK-Android:parse:1.18.5] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
What i dont understand is that the instructions asked me to do this.
2) the second way i've tried it is that i've created a new project in android and i still get the same error at that line.
here is my gradle file for the ways i've tried it:
way number 1)
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
implementation "com.github.parse-community.Parse-SDK-Android:parse:1.18.5"
}
}
plugins {
id 'com.github.ben-manes.versions' version '0.20.0'
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
compileSdkVersion = 27
supportLibVersion = '27.1.1'
firebaseJobdispatcherVersion = '0.8.5'
minSdkVersion = 14
targetSdkVersion = 27
}
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.parse">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name="App"></application>
<application />
</manifest>
way number 2)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
implementation "com.github.parse-community.Parse-SDK-Android:parse:1.18.5"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.parsetemplate">
<application
android:name="App"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

I was getting the same error when I followed parse README.MD
All you need to delete your current project and start a new one and follow the below guide.
https://www.back4app.com/docs/android/parse-android-sdk

You need to copy the complete repositories block, which is inside allprojects block from the build.gradle(Project: your_project_name), and paste it at the end of the build.gradle(Module: app) file.
After you have done that you should rebuild your project once.

Related

Android app giving network error when connecting to a database

I have a react native app that fetches books from a database and displays them. It works fine on iOS when the mongodb backend is running, but not on android. I just get a network error as shown below.
Do any of you know how to fix it?
Here is my build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
Here is my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />s
<uses-sdk android:targetSdkVersion="29" android:minSdkVersion="16" tools:overrideLibrary="com.facebook.react"/>
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
</manifest>
Please let me know how to fix this.
Thanks.
(Please let me know in the comments if you need to see any frontend or backend files.)
I fixed this issue and thought the solution might help someone else. All that was happening was that the emulator was not getting localhost. To fix this, in my front end, I replaced localhost:3000 with 10.0.2.2:3000. It fixed the issue.
Instead of
.post('http://localhost:3000/login'...
it should be
.post('http://10.0.2.2:3000/login'...
Thanks to #Raghav Herugu for helping me solve the problem

Error Failed to resolve: com.google.android.gms:play-services-wallet:11.4.0 [duplicate]

This question already has answers here:
Failed to resolve com.google.android.gms play-services-auth:11.4.0
(13 answers)
Failed to resolve: com.android.support:cardview-v7:26.0.0 android
(26 answers)
Closed 5 years ago.
I'm trying to follow the tutorial for the Google Payment API found here:
https://developers.google.com/payments/setup
I'm getting the following errors when I sync the gradle
Mainly - I get the error:
Failed to resolve: com.google.android.gms:play-services-wallet:11.4.0
There is a link under the error to "Install Repository and sync project" but when I click that, nothing happens.
Is there a way to manually install the necessary repository? Is there something else that I'm missing? What repository do I even need to install? I've tried to update everything.
Gradle:
{
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.google.android.gms.samples.wallet"
minSdkVersion 26
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.google.android.gms:play-services-wallet:11.4.0'
compile 'com.google.android.gms:play-services-tasks:11.4.0'
compile 'com.google.android.gms:play-services-base:11.4.0'
compile 'com.google.android.gms:play-services-basement:11.4.0'
}
Top Level Gradle
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Manifest
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name="MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Enables the Google Payment API -->
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />
</application>
I've been trying to get this to run for about a week, and can't get the the gradle to sync whenever I include google wallet. I've followed the tutorial as closely as I can. I've tried it with their sample app from github, from my own app, from a couple apps from scratch. I have no idea how to get this repository to work.
Thanks.
John
You should add the google maven to allprojects not to buildscript. So, change it to something like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I was having the same issue this morning as well... But the Fix is Instead of using "11.4.0" you should be using "11.0.4". Maybe an error on their website because when you put "11.4.0" Android Studio is giving you that error and it tells you to update to the latest version which is "11.0.4".
To sum up, use this one and it should work
compile 'com.google.android.gms:play-services-wallet:11.0.4'

can't compile FirebaseUI

I'm trying to make simple chat application for Android. For this I need to import FirebaseUI class to the project. I'm facing the problem, that many people had before, but still following all their decisions, cant solve this problem. I try to:
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.firebaseui.firebase-ui:1.2.0'
I'm following all instructions, like:
apply plugin: 'com.google.gms.google-services'
adding maven url:
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
}
dependencies:
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
and AndroidManifest:
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
tools:replace="android:supportsRtl"
Still get the Error:
Error:Failed to resolve: com.firebaseui.firebase-ui:1.2.0:
Can someone help please? I applied all the solutions described before and dont understand, what the problem? Maybe i should just create new project, due to the i changed that one so many times with so many errors in building gradle?)

Android Studio doesnt recognize my device - LG Spirit 4G

I have developer options enabled, the driver is updated(says the OS win10), and I followed the instructions of the documentation. My manifest :
<application
android:debuggable="true" //this line says it shouldnt be harcoded?
android:allowBackup="true"
android:icon="#drawable/ic_piano"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
And the build graddle file:
android {
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android {
buildTypes {
debug {
debuggable true
}
Both manifest and build code copied from the documentation. But it fails to build.graddle. It says: expectin '}' found "
I dont know what is this suposed to mean, since i've done everything the documentation says. I've serached all the answers here in SO but haven't any that worked...Any ideias?
The link: https://developer.android.com/studio/run/device.html
You have messed up your build.gradle, it should look like this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Note that this is your top level build.gradle, it will sit in the root directory of your project. There should another build.gradle inside of a folder likely called /app this is the file where you add and amend the android{} gradle clojure

Error:Execution failed for task ':app:fabricGenerateResourcesDebug'. > Crashlytics Developer Tools error

Trying to add Twitter Fabric SDK. I have added all dependencies suggested by Twitter.
Modified my build.gradle:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/repo' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.3'
// The Fabric Gradle plugin uses an open ended version to
// react quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
//Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'
repositories {
jcenter()
maven { url 'https://maven.fabric.io/repo' }
}
When tries to synch got this error:
Error:Execution failed for task
':app:fabricGenerateResourcesDebug'. > Crashlytics Developer Tools error.
While project was build successful before modifying build.gradle file for Twitter SDK.
You need to add your API Key to the Android Manifest:
<application>
<meta-data
android:name="com.crashlytics.ApiKey"
android:value="your key here" />
</application>
Same solution is provided here.
Try the next solution:
Open your fabric plug-in and then open Crashlytics
If you don't have install Crashlytics install it. This will modify and sync your build.gradle
I did this and it worked for me. Hope it work for you.
I got this error after linking my fabric API key to a string resource like so:
<meta-data
android:name="io.fabric.ApiKey"
android:value="#string/fabric_api_key" />
Solved it by putting the API key as a string literal in the value attribute:
<meta-data
android:name="io.fabric.ApiKey"
android:value="123905329fakekey023904909423" />

Categories

Resources