René's URL Explorer Experiment


Title: Adding file to Android build at app/src/main/assets for `getAssets()` · Issue #700 · NativeScript/android · GitHub

Open Graph Title: Adding file to Android build at app/src/main/assets for `getAssets()` · Issue #700 · NativeScript/android

X Title: Adding file to Android build at app/src/main/assets for `getAssets()` · Issue #700 · NativeScript/android

Description: @bradmartin commented on Thu Feb 02 2017 Please, provide the details below: Trying to build a plugin which is calling the following code: public static Cancellable fromAssetFileName(Context context, String fileName, OnCompositionLoadedLi...

Open Graph Description: @bradmartin commented on Thu Feb 02 2017 Please, provide the details below: Trying to build a plugin which is calling the following code: public static Cancellable fromAssetFileName(Context context...

X Description: @bradmartin commented on Thu Feb 02 2017 Please, provide the details below: Trying to build a plugin which is calling the following code: public static Cancellable fromAssetFileName(Context context...

Opengraph URL: https://github.com/NativeScript/android/issues/700

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Adding file to Android build at app/src/main/assets for `getAssets()`","articleBody":"@bradmartin commented on [Thu Feb 02 2017](https://github.com/NativeScript/NativeScript/issues/3560)\r\n\r\n## Please, provide the details below:\r\n\r\nTrying to build a plugin which is calling the following code:\r\n\r\n```\r\n public static Cancellable fromAssetFileName(Context context, String fileName, OnCompositionLoadedListener loadedListener) {\r\n        InputStream stream;\r\n        try {\r\n            stream = context.getAssets().open(fileName);\r\n        } catch (IOException e) {\r\n            throw new IllegalStateException(\"Unable to find file \" + fileName, e);\r\n        }\r\n        return fromInputStream(context, stream, loadedListener);\r\n    }\r\n```\r\n\r\nThe public method to get to that ^^^ is just accepting a string for the `fileName` argument. The README for the android lib says to put the file at `app/src/main/assets`. I've tried creating an `assets` folder in app_resources which obviously doesn't package up there. I've tried at the root of the `app` folder and no good. So is there some way to add files (this is a .json file) to that location for an android build with NS. The android code calling `getAssets()` returns the [AssetManager](https://developer.android.com/reference/android/content/res/AssetManager.html) and is calling `open()` with the given file name. So how do we get files to be accessible with this in a NS app is the question now that I think about it 😄 \r\n\r\n\r\n### Did you verify this is a real problem by searching [Stack Overflow](http://stackoverflow.com/questions/tagged/nativescript) and the [other open issues in this repo](https://github.com/NativeScript/nativescript/issues)?\r\n\r\nYes.\r\n\r\n### Which platform(s) does your issue occur on?\r\n\r\nAndroid\r\n\r\n### Please provide the following version numbers that your issue occurs with:\r\n\r\nNS 2.5 everything - just updated.\r\n\r\n### Please tell us how to recreate the issue in as much detail as possible.\r\n\r\nCreate an app, try to create an .apk with a file located in `app/src/main/assets` at the output I suppose.\r\n\r\n### Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.\r\n\r\nNo, just wrapping a lib.\r\n\r\n\r\n\r\n---\r\n\r\n@bradmartin commented on [Thu Feb 02 2017](https://github.com/NativeScript/NativeScript/issues/3560#issuecomment-276881009)\r\n\r\nThere is another method to go about, but was hoping to access the simplest of them with just passing the file name 👍 \r\n\r\n---\r\n\r\n@bradmartin commented on [Thu Feb 02 2017](https://github.com/NativeScript/NativeScript/issues/3560#issuecomment-276883655)\r\n\r\nAnd opening up `platforms/android/src/main/assets` and placing the .json file isn't really a good solution for new NS devs or anyone since it'll be blasted during a build/platform clean. Doing this does work, so the native lib is expecting the file to be located in the `assets` folder.\r\n\r\n","author":{"url":"https://github.com/petekanev","@type":"Person","name":"petekanev"},"datePublished":"2017-02-02T08:34:58Z","url":"https://github.com/NativeScript/android/issues/700"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:ba5c6643-1961-5d07-b3d1-28e3adb9c1df
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBECA:240CD1:13BE7D4:1922159:6B0127E7
html-safe-nonce4829b1eb492b066b216e7afd21c58e79345960166d495dbe3d002e4f1d3759c5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRUNBOjI0MENEMToxM0JFN0Q0OjE5MjIxNTk6NkIwMTI3RTciLCJ2aXNpdG9yX2lkIjoiNzYyOTgzNTYwNzI4NzYwNTIyMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac82832996b50478e518e043d32310199556400aa5e5372234f9cba0f056b411fe
hovercard-subject-tagissue:204810956
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/android/700/issue_layout
twitter:imagehttps://opengraph.githubassets.com/6af320bca2e9ebe2ea375ec0797b2d7d1e3a139394809f6c965c5a40d03945e0/NativeScript/android/issues/700
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/6af320bca2e9ebe2ea375ec0797b2d7d1e3a139394809f6c965c5a40d03945e0/NativeScript/android/issues/700
og:image:alt@bradmartin commented on Thu Feb 02 2017 Please, provide the details below: Trying to build a plugin which is calling the following code: public static Cancellable fromAssetFileName(Context context...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepetekanev
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/NativeScript/android git https://github.com/NativeScript/android.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id29137950
octolytics-dimension-repository_nwoNativeScript/android
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id29137950
octolytics-dimension-repository_network_root_nwoNativeScript/android
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/NativeScript/android-runtime/issues/700#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fandroid%2Fissues%2F700
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fandroid%2Fissues%2F700
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=NativeScript%2Fandroid
Reloadhttps://github.com/NativeScript/android-runtime/issues/700
Reloadhttps://github.com/NativeScript/android-runtime/issues/700
Reloadhttps://github.com/NativeScript/android-runtime/issues/700
NativeScripthttps://github.com/NativeScript
androidhttps://github.com/NativeScript/android
Codehttps://github.com/NativeScript/android
Issues106 (106)https://github.com/NativeScript/android/issues
Pull requests24 (24)https://github.com/NativeScript/android/pulls
Actionshttps://github.com/NativeScript/android/actions
Projectshttps://github.com/NativeScript/android/projects
Wikihttps://github.com/NativeScript/android/wiki
Security and qualityhttps://github.com/NativeScript/android/security
Insightshttps://github.com/NativeScript/android/insights
https://github.com/NativeScript/android
New issuehttps://github.com/login?return_to=https://github.com/NativeScript/android/issues/700
New issuehttps://github.com/login?return_to=https://github.com/NativeScript/android/issues/700
Adding file to Android build at app/src/main/assets for getAssets()https://github.com/NativeScript/android/issues/700#top
https://github.com/petekanev
featurehttps://github.com/NativeScript/android/issues?q=state%3Aopen%20label%3A%22feature%22
4.0.0https://github.com/NativeScript/android/milestone/27
https://github.com/petekanev
petekanevhttps://github.com/petekanev
on Feb 2, 2017https://github.com/NativeScript/android/issues/700#issue-204810956
@bradmartinhttps://github.com/bradmartin
Thu Feb 02 2017https://github.com/NativeScript/NativeScript/issues/3560
AssetManagerhttps://developer.android.com/reference/android/content/res/AssetManager.html
Stack Overflowhttp://stackoverflow.com/questions/tagged/nativescript
other open issues in this repohttps://github.com/NativeScript/nativescript/issues
@bradmartinhttps://github.com/bradmartin
Thu Feb 02 2017https://github.com/NativeScript/NativeScript/issues/3560#issuecomment-276881009
@bradmartinhttps://github.com/bradmartin
Thu Feb 02 2017https://github.com/NativeScript/NativeScript/issues/3560#issuecomment-276883655
petekanevhttps://github.com/petekanev
featurehttps://github.com/NativeScript/android/issues?q=state%3Aopen%20label%3A%22feature%22
on Feb 6, 2017https://github.com/NativeScript/android/issues/700#event-950158718
https://github.com/vjoao
vjoaohttps://github.com/vjoao
on Apr 9, 2017https://github.com/NativeScript/android/issues/700#issuecomment-292816957
https://github.com/petekanev
petekanevhttps://github.com/petekanev
on Apr 10, 2017https://github.com/NativeScript/android/issues/700#issuecomment-292860149
@vjoaohttps://github.com/vjoao
#561https://github.com/NativeScript/android/issues/561
https://github.com/rhanb
rhanbhttps://github.com/rhanb
on Oct 6, 2017https://github.com/NativeScript/android/issues/700#issuecomment-334812920
@vjoaohttps://github.com/vjoao
https://github.com/rhanb/nativescript-dev-assets/https://github.com/rhanb/nativescript-dev-assets/
petekanevhttps://github.com/petekanev
on Dec 14, 2017https://github.com/NativeScript/android/issues/700#event-1387735789
petekanevhttps://github.com/petekanev
plannedhttps://github.com/NativeScript/android/issues?q=state%3Aopen%20label%3A%22planned%22
on Jan 25, 2018https://github.com/NativeScript/android/issues/700#event-1441709116
petekanevhttps://github.com/petekanev
in progresshttps://github.com/NativeScript/android/issues?q=state%3Aopen%20label%3A%22in%20progress%22
plannedhttps://github.com/NativeScript/android/issues?q=state%3Aopen%20label%3A%22planned%22
on Feb 7, 2018https://github.com/NativeScript/android/issues/700#event-1462703799
petekanevhttps://github.com/petekanev
on Mar 5, 2018https://github.com/NativeScript/android/issues/700#event-1503925365
https://github.com/petekanev
petekanevhttps://github.com/petekanev
on Mar 5, 2018https://github.com/NativeScript/android/issues/700#issuecomment-370395214
NativeScript/nativescript-cli#3347https://github.com/NativeScript/nativescript-cli/pull/3347
petekanevhttps://github.com/petekanev
ready for testhttps://github.com/NativeScript/android/issues?q=state%3Aopen%20label%3A%22ready%20for%20test%22
in progresshttps://github.com/NativeScript/android/issues?q=state%3Aopen%20label%3A%22in%20progress%22
on Mar 8, 2018https://github.com/NativeScript/android/issues/700#event-1510750288
miroslavaivanovahttps://github.com/miroslavaivanova
completedhttps://github.com/NativeScript/android/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Mar 16, 2018https://github.com/NativeScript/android/issues/700#event-1525103446
miroslavaivanovahttps://github.com/miroslavaivanova
ready for testhttps://github.com/NativeScript/android/issues?q=state%3Aopen%20label%3A%22ready%20for%20test%22
on Mar 16, 2018https://github.com/NativeScript/android/issues/700#event-1525103626
Sign up for freehttps://github.com/signup?return_to=https://github.com/NativeScript/android/issues/700
Sign in to commenthttps://github.com/login?return_to=https://github.com/NativeScript/android/issues/700
petekanevhttps://github.com/petekanev
featurehttps://github.com/NativeScript/android/issues?q=state%3Aopen%20label%3A%22feature%22
4.0.0https://github.com/NativeScript/android/milestone/27
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.