Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
346 views
in Technique[技术] by (71.8m points)

How to link assets/www folder in Eclipse / Phonegap / Android project?

I am working on a PhoneGap app that is supposed to run on iOS and Android. My folder structure looks like this:

+-+-[app folder]
  |
  +-[android] (contains Eclipse workspace and project files)
  |
  +-[iOS] (contains XCode project files)
  |
  +-[www] (contains all html, js, css etc. files for the actual app)

It's easy to reference the www folder in the XCode project, everything there works fine.

However, creating a link to the www folder in Eclipse doesn't work as expected: I used 'Import -> Filesystem' to create the link under the existing assets folder and everything seemed to work fine. But the files are not getting copied to the apk during the build step.
Any idea what I am doing wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This can be accomplished creating a "Linked Folder" resource in Eclipse. It's essentially the same thing as what Xcode creates when you drag any file or folder into your project and tell it to create references - just nowhere near as easy.

The ADT Eclipse plugin expects an "assets" folder at the top level of your project, so we're going to create an /assets linked folder that references ../www, sitting right next to your project folder.

  1. File menu > New > Folder
  2. Folder name: assets
  3. Click Advanced >>
  4. Select: Link to alternate location (Linked Folder)
    • You can use Browse to select the www folder and you're done, but this option creates the link using a full path which will usually break on other team members' systems
  5. Click Variables...
  6. New
    1. Name: SIBLING_WWW_FOLDER
    2. Location: ${PROJECT_LOC}/../www
  7. OK
  8. Select SIBLING_WWW_FOLDER and click OK
  9. Finish

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...