Resource not found: /credentials.json Google Sheets API - java

I follow the google Sheets quickstart and download the credentials.json put in my project main/res.
No matter how I change the place, it always shows the error java.io.FileNotFoundException: Resource not found: /credentials.json
I have tried the other way that I found in this post:
java.io.FileNotFoundException: Resource not found: /credentials.json on Java QuickStart for Classroom API
But still the same.
Can anyone tell me how to fix it? I google it for a long time. Thanks

You are storing the credentials.json file in the main app folder but, as you can see in the corresponding Java Quickstart for Sheets API, this file should be in src/main/resources/.
Your issue should be solved by moving the file to the specified location.

I use the android studio, and I solved it by created a res/raw folder.
Then moved the credential.json into it.
And use the following code instead to access it.
InputStream in = this.getResources().openRawResource(R.raw.credentials);

Related

Could not load wrapper properties in android studio

please help me, when i create a new project in android studio there is an error
Could not load wrapper properties from Could not load wrapper properties from 'C:\Users\baren\AndroidStudioProjects\ToyaGarage\gradle\wrapper\gradle-wrapper.properties'.
1
enter image description here
In my case, I have a blank space at the end of "distributionUrl" row
I Searched for your problem and i found this,maybe this solution can help you https://stackoverflow.com/a/64439711/15805169
Delete the wrapper properties file in your app that is having the problem and copy the wrapper property file from your working apps to the same place where you deleted that file.
this is like the basic path to get to that file
C:\Users\TT Virtual\AndroidStudioProjects\KotlinFirebaseAuth\gradle\wrapper
remember this here is my path to that file

Find a directory in Android Studio Project not in the phone

I am trying to get access to a text file (log.txt) in a directory. All other questions on this topic refer to getting directories from the emulators internal storage.
My file structure is as such
>androidApp
->App
-->Build
-->src
--->game_log
---->log.txt
--->Main
---->(Android app Code further)
Using new File(System.getProperty("user.dir) + "app\\src\\game_log\\log.txt").exists() gets me false.
Another thing I tried was System.getProperty("user.dir") but that yields me /.
Contextwrapper.getPath() gets me the path of the emulators storage.
Is the file structure of Android Studio different or I am using the wrong method to get the file from my project folder?

openRawResource() throws always a NotFoundException

I want to load a keystore in my Android application. I have copied the key (truststore.bks) into the folder res/raw. The SDK from Android generate the R.java with a entry for trustsotre. In the App in try to use:
Resources.getSystem().openRawResource(R.raw.truststore);
But I get always a exception:
android.content.res.Resources$NotFoundException: Resource ID #0x7f040000
I look into the apk File und saw the truststore.bks file is in the folderres/raw/.
What is my misstake?
The problem is that you are using the system level resources with the call to Resources.getSystem. Specifically the documentation states that this does not provide access to application resources. You need to call getResources on a Context object in your application - all your activities are a Context object since they inherit from Context.
does your R.java contains corresponding entry for it.....
try deleting R.java and building again....
though I am not completely aware of ur problem....
And this isnt a proper solution as well....

no clientlets found for response, using the lobo browser

i am using the lobo browser, and when i run the example code, i keep getting the following exception:
java.lang.IllegalStateException: No clientlets found for response: ClientletResponseImpl[url=http://www.google.com,method=GET,mimeType=text/html,fromCache=false,requestType=PROGRAMMATIC'.
anyone have any idea?
I had the same problem when i was trying to embed the FramePanel in my java application.
I think there is a dependency in the code that there will be a directory with name "ext" and the extension jars are present in that directory. "ext" directory should be at the same level as lobo.jar file. This solved my problem.

fetching problem of header of song files

for getting information of song header i see the following sites for reference.
1)http://www.jthink.net/jaudiotagger/examples_id3.jsp
and i created a project with download files from following site
2)http://java.net/projects/jaudiotagger/sources/svn/show/tags/2.0.2/src/org/jaudiotagger/audio/mp3?rev=969
i get error even if build with given jid3lib-0.5.4.jar and no main method please give guide to done the project
For mp3 files you could use the Java ID3 Tag Library to extract information.

Categories

Resources