Read Custom file from /app/ folder - Android2019 Community Moderator ElectionFling gesture detection on grid layout'Must Override a Superclass Method' Errors after importing a project into EclipseIs quitting an application frowned upon?How do I get the SharedPreferences from a PreferenceActivity in Android?How to avoid reverse engineering of an APK file?How to manually include external aar package using new Gradle Android Build SystemBuilding and running app via Gradle and Android Studio is slower than via EclipseDoes anyone have benchmarks (code & results) comparing performance of Android apps written in Xamarin C# and Java?Dilemma: when to use Fragments vs Activities:android.os.FileUriExposedException: file:///storage/emulated/0/test.txt exposed beyond app through Intent.getData()

Does the US political system, in principle, allow for a no-party system?

What's the best tool for cutting holes into duct work?

Are there other characters in the Star Wars universe who had damaged bodies and needed to wear an outfit like Darth Vader?

School performs periodic password audits. Is my password compromised?

Did Amazon pay $0 in taxes last year?

What is the meaning of option 'by' in TikZ Intersections

Was it really inappropriate to write a pull request for the company I interviewed with?

Is there a math equivalent to the conditional ternary operator?

Ultrafilters as a double dual

Can a space-faring robot still function over a billion years?

Convert an array of objects to array of the objects' values

PTIJ: Aliyot for the deceased

Integrating function with /; in its definition

Quitting employee has privileged access to critical information

Professor forcing me to attend a conference

If nine coins are tossed, what is the probability that the number of heads is even?

Paper published similar to PhD thesis

What does it mean when I add a new variable to my linear model and the R^2 stays the same?

Remove object from array based on array of some property of that object

Why do we call complex numbers “numbers” but we don’t consider 2 vectors numbers?

Affine transformation of circular arc in 3D

I've given my players a lot of magic items. Is it reasonable for me to give them harder encounters?

Dukha vs legitimate need

Should we avoid writing fiction about historical events without extensive research?



Read Custom file from /app/ folder - Android



2019 Community Moderator ElectionFling gesture detection on grid layout'Must Override a Superclass Method' Errors after importing a project into EclipseIs quitting an application frowned upon?How do I get the SharedPreferences from a PreferenceActivity in Android?How to avoid reverse engineering of an APK file?How to manually include external aar package using new Gradle Android Build SystemBuilding and running app via Gradle and Android Studio is slower than via EclipseDoes anyone have benchmarks (code & results) comparing performance of Android apps written in Xamarin C# and Java?Dilemma: when to use Fragments vs Activities:android.os.FileUriExposedException: file:///storage/emulated/0/test.txt exposed beyond app through Intent.getData()










-1















How can we read a file content which is located in the project /app/ folder?. My intention is to keep some credentials in that file and read the file in build.gradle or in my application class.



I looking for an implementation like Firebase "google-services.json" file.










share|improve this question


























    -1















    How can we read a file content which is located in the project /app/ folder?. My intention is to keep some credentials in that file and read the file in build.gradle or in my application class.



    I looking for an implementation like Firebase "google-services.json" file.










    share|improve this question
























      -1












      -1








      -1








      How can we read a file content which is located in the project /app/ folder?. My intention is to keep some credentials in that file and read the file in build.gradle or in my application class.



      I looking for an implementation like Firebase "google-services.json" file.










      share|improve this question














      How can we read a file content which is located in the project /app/ folder?. My intention is to keep some credentials in that file and read the file in build.gradle or in my application class.



      I looking for an implementation like Firebase "google-services.json" file.







      android android-gradle android-file






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked yesterday









      Muhamed Riyas MMuhamed Riyas M

      3,41811922




      3,41811922






















          1 Answer
          1






          active

          oldest

          votes


















          1















          How can we read a file content which is located in the project /app/ folder?




          Those are files on your development machine. They are not necessarily files on the device.




          I looking for an implementation like Firebase "google-services.json" file.




          AFAIK, that is used by a Gradle plugin on your development machine.




          My intention is to keep some credentials in that file and read the file in build.gradle or in my application class.




          Store the data in gradle.properties. Those values can be accessed like global variables in your build.gradle file. In addition to using those values directly, you can use buildConfigField or resValue statements in build.gradle to make the values available to your app code (via BuildConfig or values-type resources, respectively).



          If you would prefer not to use gradle.properties, you can create your own properties file, JSON file, XML file, etc. Your Gradle code would need to read in that file and extract values from it. Then, you can use buildConfigField or resValue to expose that data to your app code.



          More elaborate possibilities include:



          • Storing your data as an XML resource (res/xml/) for use at runtime, and teach your Gradle script to parse that file


          • Storing your data as an asset (assets/) for use at runtime, and teach your Gradle script to parse that file






          share|improve this answer























          • Thanks!. If I stored any where under "main" folder it can be identified by reverse engineering.

            – Muhamed Riyas M
            yesterday












          • @MuhamedRiyasM: Everything in your APK can be identified by reverse engineering.

            – CommonsWare
            yesterday











          • Oops!. But I cannot find the google-services.json file contents or even the file itself by reverse engineering!

            – Muhamed Riyas M
            yesterday











          • @MuhamedRiyasM: As I wrote, AFAIK, that is processed by a Gradle plugin, and it is not directly at runtime.

            – CommonsWare
            yesterday










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55023115%2fread-custom-file-from-app-folder-android%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1















          How can we read a file content which is located in the project /app/ folder?




          Those are files on your development machine. They are not necessarily files on the device.




          I looking for an implementation like Firebase "google-services.json" file.




          AFAIK, that is used by a Gradle plugin on your development machine.




          My intention is to keep some credentials in that file and read the file in build.gradle or in my application class.




          Store the data in gradle.properties. Those values can be accessed like global variables in your build.gradle file. In addition to using those values directly, you can use buildConfigField or resValue statements in build.gradle to make the values available to your app code (via BuildConfig or values-type resources, respectively).



          If you would prefer not to use gradle.properties, you can create your own properties file, JSON file, XML file, etc. Your Gradle code would need to read in that file and extract values from it. Then, you can use buildConfigField or resValue to expose that data to your app code.



          More elaborate possibilities include:



          • Storing your data as an XML resource (res/xml/) for use at runtime, and teach your Gradle script to parse that file


          • Storing your data as an asset (assets/) for use at runtime, and teach your Gradle script to parse that file






          share|improve this answer























          • Thanks!. If I stored any where under "main" folder it can be identified by reverse engineering.

            – Muhamed Riyas M
            yesterday












          • @MuhamedRiyasM: Everything in your APK can be identified by reverse engineering.

            – CommonsWare
            yesterday











          • Oops!. But I cannot find the google-services.json file contents or even the file itself by reverse engineering!

            – Muhamed Riyas M
            yesterday











          • @MuhamedRiyasM: As I wrote, AFAIK, that is processed by a Gradle plugin, and it is not directly at runtime.

            – CommonsWare
            yesterday















          1















          How can we read a file content which is located in the project /app/ folder?




          Those are files on your development machine. They are not necessarily files on the device.




          I looking for an implementation like Firebase "google-services.json" file.




          AFAIK, that is used by a Gradle plugin on your development machine.




          My intention is to keep some credentials in that file and read the file in build.gradle or in my application class.




          Store the data in gradle.properties. Those values can be accessed like global variables in your build.gradle file. In addition to using those values directly, you can use buildConfigField or resValue statements in build.gradle to make the values available to your app code (via BuildConfig or values-type resources, respectively).



          If you would prefer not to use gradle.properties, you can create your own properties file, JSON file, XML file, etc. Your Gradle code would need to read in that file and extract values from it. Then, you can use buildConfigField or resValue to expose that data to your app code.



          More elaborate possibilities include:



          • Storing your data as an XML resource (res/xml/) for use at runtime, and teach your Gradle script to parse that file


          • Storing your data as an asset (assets/) for use at runtime, and teach your Gradle script to parse that file






          share|improve this answer























          • Thanks!. If I stored any where under "main" folder it can be identified by reverse engineering.

            – Muhamed Riyas M
            yesterday












          • @MuhamedRiyasM: Everything in your APK can be identified by reverse engineering.

            – CommonsWare
            yesterday











          • Oops!. But I cannot find the google-services.json file contents or even the file itself by reverse engineering!

            – Muhamed Riyas M
            yesterday











          • @MuhamedRiyasM: As I wrote, AFAIK, that is processed by a Gradle plugin, and it is not directly at runtime.

            – CommonsWare
            yesterday













          1












          1








          1








          How can we read a file content which is located in the project /app/ folder?




          Those are files on your development machine. They are not necessarily files on the device.




          I looking for an implementation like Firebase "google-services.json" file.




          AFAIK, that is used by a Gradle plugin on your development machine.




          My intention is to keep some credentials in that file and read the file in build.gradle or in my application class.




          Store the data in gradle.properties. Those values can be accessed like global variables in your build.gradle file. In addition to using those values directly, you can use buildConfigField or resValue statements in build.gradle to make the values available to your app code (via BuildConfig or values-type resources, respectively).



          If you would prefer not to use gradle.properties, you can create your own properties file, JSON file, XML file, etc. Your Gradle code would need to read in that file and extract values from it. Then, you can use buildConfigField or resValue to expose that data to your app code.



          More elaborate possibilities include:



          • Storing your data as an XML resource (res/xml/) for use at runtime, and teach your Gradle script to parse that file


          • Storing your data as an asset (assets/) for use at runtime, and teach your Gradle script to parse that file






          share|improve this answer














          How can we read a file content which is located in the project /app/ folder?




          Those are files on your development machine. They are not necessarily files on the device.




          I looking for an implementation like Firebase "google-services.json" file.




          AFAIK, that is used by a Gradle plugin on your development machine.




          My intention is to keep some credentials in that file and read the file in build.gradle or in my application class.




          Store the data in gradle.properties. Those values can be accessed like global variables in your build.gradle file. In addition to using those values directly, you can use buildConfigField or resValue statements in build.gradle to make the values available to your app code (via BuildConfig or values-type resources, respectively).



          If you would prefer not to use gradle.properties, you can create your own properties file, JSON file, XML file, etc. Your Gradle code would need to read in that file and extract values from it. Then, you can use buildConfigField or resValue to expose that data to your app code.



          More elaborate possibilities include:



          • Storing your data as an XML resource (res/xml/) for use at runtime, and teach your Gradle script to parse that file


          • Storing your data as an asset (assets/) for use at runtime, and teach your Gradle script to parse that file







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered yesterday









          CommonsWareCommonsWare

          776k13918921938




          776k13918921938












          • Thanks!. If I stored any where under "main" folder it can be identified by reverse engineering.

            – Muhamed Riyas M
            yesterday












          • @MuhamedRiyasM: Everything in your APK can be identified by reverse engineering.

            – CommonsWare
            yesterday











          • Oops!. But I cannot find the google-services.json file contents or even the file itself by reverse engineering!

            – Muhamed Riyas M
            yesterday











          • @MuhamedRiyasM: As I wrote, AFAIK, that is processed by a Gradle plugin, and it is not directly at runtime.

            – CommonsWare
            yesterday

















          • Thanks!. If I stored any where under "main" folder it can be identified by reverse engineering.

            – Muhamed Riyas M
            yesterday












          • @MuhamedRiyasM: Everything in your APK can be identified by reverse engineering.

            – CommonsWare
            yesterday











          • Oops!. But I cannot find the google-services.json file contents or even the file itself by reverse engineering!

            – Muhamed Riyas M
            yesterday











          • @MuhamedRiyasM: As I wrote, AFAIK, that is processed by a Gradle plugin, and it is not directly at runtime.

            – CommonsWare
            yesterday
















          Thanks!. If I stored any where under "main" folder it can be identified by reverse engineering.

          – Muhamed Riyas M
          yesterday






          Thanks!. If I stored any where under "main" folder it can be identified by reverse engineering.

          – Muhamed Riyas M
          yesterday














          @MuhamedRiyasM: Everything in your APK can be identified by reverse engineering.

          – CommonsWare
          yesterday





          @MuhamedRiyasM: Everything in your APK can be identified by reverse engineering.

          – CommonsWare
          yesterday













          Oops!. But I cannot find the google-services.json file contents or even the file itself by reverse engineering!

          – Muhamed Riyas M
          yesterday





          Oops!. But I cannot find the google-services.json file contents or even the file itself by reverse engineering!

          – Muhamed Riyas M
          yesterday













          @MuhamedRiyasM: As I wrote, AFAIK, that is processed by a Gradle plugin, and it is not directly at runtime.

          – CommonsWare
          yesterday





          @MuhamedRiyasM: As I wrote, AFAIK, that is processed by a Gradle plugin, and it is not directly at runtime.

          – CommonsWare
          yesterday



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55023115%2fread-custom-file-from-app-folder-android%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

          2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme