Apollo - endpoint http not found in root project - android

I am trying to load a schema through introspection: according to the docs I should run the following in my project root directory:
mkdir -p app/src/main/graphql/com/example/rocketreserver/ ./gradlew :app:downloadApolloSchema -Pcom.apollographql.apollo.endpoint='https://apollo-fullstack-tutorial.herokuapp.com/' -Pcom.apollographql.apollo.schema='src/main/graphql/com/example/rocketreserver/schema.json'
So, I changed it to:
mkdir -p app/src/main/graphql/com/myapp/ ./gradlew :app:downloadApolloSchema -Pcom.apollographql.apollo.endpoint='http://localhost:4000/graphql/' -Pcom.apollographql.apollo.schema='src/main/graphql/com/myapp/schema.json'
However I'm getting the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Project '.apollographql.apollo.endpoint=http' not found in root project 'MyApp'.
I've added the apollo plugin in the app level gradle file:
id("com.apollographql.apollo").version("2.3.1")
I've also registered the task like:
tasks.register("downloadSchema", com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask.class) {
endpointUrl.set("https://localhost:4000/graphql")
schemaFilePath.set("src/main/graphql/com/myapp/schema.json")
}
I'm not sure what the error means exactly, I've searched for it, but can't find a reference or a solution.
Note: I get the same error when I try to run the exact same command given in the docs.

Turns out the command posted in the docs is wrong, it should be:
mkdir -p app/src/main/graphql/com/bangenergy/ ./gradlew :app:downloadApolloSchema -P com.apollographql.apollo.endpoint='http://localhost:4000/graphql/' -P com.apollographql.apollo.schema='src/main/graphql/com/bangenergy/schema.json'
Notice the space between -P and com.

This is the Windows Command
gradlew :app:downloadApolloSchema --endpoint="http://****REPLACE_WITH_YOUR_ENDPOINT/graphql/" --schema="src/main/graphql/com/example/programbuilder/schema.json"
Also the com.apollographql.apollo.schema deprecated with --schema and com.apollographql.apollo.endpoint deprecated with --endpoint

Related

Delete downloaded robolectric jars

I am writing a Gradle task around Robolectric in Android Studio. How can I delete the jars that it downloads at runtime? I need a clean slate to test my task.
I tried running clean but that didn't cause the jar to be redownloaded on next run.
Is there a command I can run? Or where can I find the directory for downloaded jars?
I could not find a designated clean command, but I found a workaround:
Run test with debug flag -d; can be set either in Preferences>Compiler>Command-line Options, or run from terminal with ./gradlew :app:testDebugUnitTest -d --tests com.package.YourTestClass.testMethod > gradle_log.txt 2>&1
In the logs, search for this: Dependency cache location:
The destination directory be specified on that line. Then you can just remove it rm -r /var/folders/directoryname

Error: Could not initialize class com.android.build.gradle.internal.crash.PluginCrashReporter

We created a ionic app with angular. When we use
ionic serve
Then its working fine.
But when we are generating android apk then we are getting this error:-
* Where:
Build file '/home/ankur/projects/ionicdesign/ionic-roots_v101/ionic
apps/kisansanchar/medical/platforms/android/app/build.gradle' line: 20
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not initialize class com.android.build.gradle.internal.crash.PluginCrashReporter
Here is complete log details:-
Paste Bin
Any idea about this error?
I've had the same issue.
Digging into gradle command with --scan, I've found the problem.
My ~/.android was owned by root, so my build (launch by my user) failed to read/write into this directory.
Solution: sudo chown -R you:you ~/.android
For me, it was the kotlin_version in build.gradle, the one used for building is lower than what was configured for my IDE, so what I did is deleted my .gradle caches by typing this in terminal rm -rf $HOME/.gradle/caches/
Then restarted my project in my case it was a flutter project so flutter run is the command. everything is taken care of after that.

How to fix cp issue during build with ninja?

I am currently compiling a custom recovery for an android phone. Sources are synced, device tree etc. all set up correctly. Now I am facing a rather banal-looking error during build. cp refuses to copy a directory, because -r is not specified in the build file.
I obviously tried to find the build file (rw_recovery/out/build_omni_daisy.ninja) and add the -r argument, but it seems to be regenerated at the beginning of every build process, as the process still fails and the previously changed line appears unchanged when opening the file after the attempted build.
These are the build steps:
. build/envsetup.sh
lunch omni_daisy-eng #config for the device
mka bootimage #device uses boot.img as recovery
This command leaves me with the following error:
[ 99% 6883/6884] Prebuilt (rw_recovery/out/target/product/daisy/kernel)
FAILED: rw_recovery/out/target/product/daisy/kernel
/bin/bash -c "(rm -f /home/luca/rw_recovery/out/target/product/daisy/kernel) && (cp rw_recovery/out/target/product/daisy/obj/KERNEL_OBJ/arch/arm64/boot/ rw_recovery/out/target/product/daisy/kernel )"
cp: -r not specified; omitting directory 'rw_recovery/out/target/product/daisy/obj/KERNEL_OBJ/arch/arm64/boot/'
ninja: build stopped: subcommand failed.
17:13:06 ninja failed with: exit status 1
I would love to hear any suggestions about how to force ninja to execute the command with -r. Alternatively, suggestions about where to find the file from which the above mentioned build file is recreated after executing mka command are much welcomed as well.

cordova android build failure: processArmv7DebugResources

I'm building a hybrid app with cordova. The setup has been tested with simple application. Both android and iOS build works fine.
After switching to a more complex application, the following error occurred. I googled and found some suggested solution but none of the worked.
I'm new to this so any suggestion appreciated.
:processArmv7DebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processArmv7DebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/Cellar/android-sdk/24.4.1_1/build-tools/23.0.2/aapt'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 28.659 secs
ERROR building one of the platforms: Error code 1 for command: /Users/wliang/work/hzoom/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/wliang/work/hzoom/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
You may not have the required environment or OS to build this project
Error: Error code 1 for command: /Users/wliang/work/hzoom/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/wliang/work/hzoom/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
In my case I discovered the error with the follow command:
cordova build android -- --gradleArg=--info
I have found:
Executing task ':processArmv7DebugResources' (up-to-date check took 0.009 secs) due to:
Input file /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug/www/libs/long/dist/long.min.js.gz has been added.
Starting process 'command '/Users/astaniscia/Library/Android/sdk/build-tools/24.0.2/aapt''. Working directory: /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android Command: /Users/astaniscia/Library/Android/sdk/build-tools/24.0.2/aapt package -f --no-crunch -I /Users/astaniscia/Library/Android/sdk/platforms/android-23/android.jar -M /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/manifests/full/armv7/debug/AndroidManifest.xml -S /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/res/merged/armv7/debug -A /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug -m -J /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/generated/source/r/armv7/debug -F /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/res/resources-armv7-debug.ap_ --debug-mode --custom-package com.navionics.poc -0 apk --output-text-symbols /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/symbols/armv7/debug --no-version-vectors
Successfully started process 'command '/Users/astaniscia/Library/Android/sdk/build-tools/24.0.2/aapt''
Unable to add '/Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug/www/libs/long/dist/long.min.js.gz': file already in archive (try '-u'?)
ERROR: unable to process assets while packaging '/Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/res/resources-armv7-debug.ap_'
:processArmv7DebugResources FAILED
:processArmv7DebugResources (Thread[Daemon worker Thread 16,5,main]) completed. Took 0.312 secs.
and this line helped me
Unable to add '/Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug/www/libs/long/dist/long.min.js.gz': file already in archive (try '-u'?)
for me solve the problem... I removed the gzip and now all work fine!
I had the same issue and this is what I found to be the issue.
The bower components folder - which normally defaults to www/lib/ using cordova - was the culprit in my case.
I had modified one of the bower components, to do that I had to first run npm install inside the specific package that I was updating. After doing that there was a node_modules folder inside the specific component I was updating i.e. www/lib/{name_of_component}/node_modules. Basically this specific node_modules folder is only used for build tools concerning the specific component, and thus it is not needed once you are done updating it and want to build the whole app. Some of the modules inside that specific component's node_modules may conflict with the projects node_modules i.e. {your_app}/node_modules - this can cause problems. In my case the conflict was with the semver module.
So in my case the solution was to delete that specific node_modules folder. After that I could build my app without any issues.
Hopefully this helps.
This is an old issue, but I recently came upon the same one and hope my experience might help someone else in the future.
After a solid day of looking around I realized it had to do with my plugins. For some reason there was an unused dependency in package.json that wouldn't allow it to build.
In my case, it was Firebase, and after removing it from package.json and the plugins folder I ran
cordova platform remove android
and
cordova platform add android
then built it again and all of a sudden it was up and running!
This error shows up because you have one or several accentuated filenames in your project folder. In my case, it was an image with the char "ç".
This topic can help rename automatically: https://superuser.com/questions/617517/remove-all-illegal-characters-from-all-filenames-in-a-given-folder
For me it was the node_modules folder inside www that caused the problem.
The solution is to copy your www to another folder and exclude node_modules and you will be fine.
The thing that worked for me :
cordova plugin add cordova-android-support-gradle-release
Thanks to lohith95
from https://forum.ionicframework.com/t/android-build-broken-after-gradle-dependencies-update-execution-failed-for-task-processdebugresources-com-android-ide-common-process-processexception-failed-to-execute-aapt/109982/170
This is might because you use crosswalk,
You can try the following commands:
sudo ionic cordova platform remove android 
sudo rm -rf ./node_modules
sudo npm install --unsafe-perm=true --allow-root
sudo npm install --unsafe-perm node-sass
sudo ionic cordova platform add android#6.4.0 
sudo ionic cordova plugin add cordova-android-support-gradle-release
sudo ionic cordova build android 

Gradle build - aapt doesn't exist

I have problem when building with gradle. It says that aapt doesn't exist, but aapt exists and have chmod 0777.
Code is ok, building with Ant works.
I give output:
:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':mergeDebugResources'.
> /home/nikodem/Workshop/PlanLekcji/res/drawable-mdpi/pt.png: Error: Cannot run program "/home/nikodem/Programy/AndroidSDK/build-tools/21.1.2/aapt": error=2, No such file or directory
/home/nikodem/Workshop/PlanLekcji/res/drawable-mdpi/pt.png is valid path to picture.
/home/nikodem/Programy/AndroidSDK/build-tools/21.1.2/aapt is valid path to aapt.
Just install these two packages for aapt and it'll be alright ;)
(Write these commands in your terminal window)
sudo apt-get install lib32stdc++6
sudo apt-get install lib32z1
I had the same problem. I solved it with
chmod +x /Android/Sdk/build-tools/21.1.2/aapt
After this my project built without errors.
I met this issue, so google for two hours, tried "install lib32stdc++6", but still not work, finnally, I just go to /AndroidSDK/build-tools/21.1.2/aapt, in the terminal, I use ./aapt , it popped errors like "./aapt: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory", I google and install this package and continue use ./aapt, it popped missing other packages, after install several, it finnally worked ,I think it is the final way to solve it. hope it helped

Categories

Resources