I have a problem with the included sample HelloCpp in cocos2d-2.0-x-2.0.4.
My environment:
Mac OSX 10.8.2
cocos2d-2.0-x-2.0.4
android-ndk-r8
The proj.ios of the sample is running fine in the xcode emulator but i have problems get the proj.android running on my Android HTC One X Device.
I am able to build the apk file with the makefile from raywenderlich and when i unzip the apk it has the assets/ipad folder included and images in it and after the installation of the apk file on the device the app loads and shows the information about frames etc. in the left lower corner of the screen. But then a notification window pops up and tells me that the program is not able to load "assets/ipad/HelloWorld.png"
The error message is thrown in cocos2dx/platform/android/CCFileUtils.ccp line 134.
Is it correct to load a png file with pData = CCFileUtils::getFileDataFromZip(s_strResourcePath.c_str(), fullPath.c_str(), pSize); ?
Because thats the line where the program is running into in cocos2dx/platform/android/CCFileUtils.ccp line 97.
the value of s_strResourcePath is /data/app/org.cocos2dx.hellocpp.apk and fullpath is assets/ipad/HelloWorld.png.
I really hope someone can help me. Or has the same problem at least.
Just check out in which folder is you all resources. In my case its in assets/Resources .. So i will setResourceDirectory as "Resources" so the path will be assets/Resources ...whereas i guess in ur case its ipad
so set it ipad
Add this lines in AppDelegate.cpp->applicationDidFinishLaunching() function. If it's already there then just change it for the android
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID )
pFileUtil->setResourceDirectory("ipad");
#endif
Try if this works
Try to add your images in "HelloCpp/Resources". Maybe you're adding image files in "HelloCpp/proj.android/assets/".
Try this:
"HelloCpp/Resources/iphone/HelloWorld.png"
"HelloCpp/Resources/ipad/HelloWorld.png"
"HelloCpp/Resources/ipadhd/HelloWorld.png"
Instead of this:
"HelloCpp/proj.android/assets/iphone/HelloWorld.png"
"HelloCpp/proj.android/assets/ipad/HelloWorld.png"
"HelloCpp/proj.android/assets/ipadhd/HelloWorld.png"
Related
I have a quiz app with:
Video assets (over 1000 files, 750 MB) that can be downloaded using the download_assets package.
Image assets (also over 1000 files, 80 MB), bundled and deployed with the app.
Filenames are stored in a sqlite database.
I'm using Android Studio, macOS.
I wrote a function that takes filenames from a database and checks which files are on a device.
As it turned out, several of the video files are unavailable on Android devices (although they are visible in Device File Explorer). On iOS devices everything is OK.
Also some images are not available, but here on both iOS and Android devices.
I wrote Python script:
import os
import chardet
dir = '/path/to/directory/with/assets'
for n in os.listdir(dir):
if (chardet.detect(os.fsencode(n))['encoding'] != 'ascii'):
print ('{} => {} (confidence: {})'.format(n, chardet.detect(os.fsencode(n))['encoding'], chardet.detect(os.fsencode(n))['confidence']))
All files that work are encoded in ascii, the rest looks like this:
pięć5.mp4 => utf-8 (confidence: 0.7525)
JAZDA NOCĄorg.mp4 => ISO-8859-1 (confidence: 0.73)
Rowerzystę W17_2.mp4 => utf-8 (confidence: 0.505)
I tried renaming files in terminal. Then I tried to use the convmv utility. When I prepared a zip in terminal with only these 3 files it worked, but when I created a full archive, it turned out that two other files that worked fine before (and which had non-Latin characters in the name) stopped loading.
My final solution: I packed the two problem files in Finder (like the first archive). Then I added the rest of the files to the archive in the terminal:
zip assets.zip *.mp4
Now all video files load on both Android and iOS devices. But why?
I also solved the problem with the image files. I tried with mv and conmv in the terminal of course. I think it worked with at least one file (I'm not sure because I was in the dark and don't know what finally worked). I got stuck with a few files and that's when I found this link.
I used the Refactor->Rename option in Android Studio. I renamed the files to those that did not contain non-Latin characters (e.g. 313D12_a_org_światło.jpg to 313D12_a_org_swiatlo.jpg). I restarted the application. Then I renamed the files in Android Studio to the old ones. After restart all the files worked.
I am writing all this for two reasons:
Maybe someone will have similar problems and this description will be useful to him.
I am very curious what is causing this behavior. Especially, why files extracted from a zip will behave differently depending on how the zip is prepared and on which device it is used (Android or iOS).
I have battled this issue for sometime now and i seem to be going nowhere, I am using file_picker flutter plugin, its working on devices with android v7, now am running the app on emulator with android v9 and the filepicker creates symlink, here is a log:
I/FilePickerUtils( 7999): File loaded and cached at:/data/user/0/com.lulliezy.videostatus/cache/file_picker/KHALIGRAPH JONES x SARKODIE - WAVY (OFFICIAL VIDEO).webm
I/FilePickerDelegate( 7999): Absolute file path:/data/user/0/com.lulliezy.videostatus/cache/file_picker/KHALIGRAPH JONES x SARKODIE - WAVY (OFFICIAL VIDEO).webm
Now my understanding bt the word cached is a symlink is created, now how do i disable this feature or rather, get the original file name with this code:
await FilePicker.getFile(
type: FileType.custom,
allowedExtensions: ['mp4', 'webm'],
);
Thanks in advance.
EDIT
I should clarify, am using flutter ffmpeg so it complains with file does not exists.
I actually found a workaround for this, I copied the picked file to another temporary directory and used that new path after which when am done, I delete the copied file.
I am trying to copy image file to backup it on my desktop which is linux mint (17.3 or Rosa) installed. I am using Infinix X510 phone with the newest version of android 6. At the beginning it was OK. But, at the end i get the message
“libmtp error: Could not get file from device”
I tried the solution as found by Googling here https://askubuntu.com/questions/879029/libmtp-error-could-not-get-file-from-device-on-attempting-to-transfer-files
But, it wasn't working for me. Is there a way to solve this matter? I need file to support my company job which supplying cosmetics.
Try compressing the file to a compressed format(tar,zip).Copy the file and then decompress it.
Changing the filename was the solution for me e.g: file.mkv to file.zip
Try to rename file, make sure file name not contain (-) (:) etc. Just rename it to alphabet
I have installed QPython in my Android mobile.
I written a statement in the QEdit to read a text file from the below path
/storage/emulated/0/com.hipipal.qpyplus/script3/File1.txt
I used the below statement
fob=open('/storage/emulated/0/com.hipipal.qpyplus/script3/File1.txt','r')
fob.read()
If I run the statement, it is throwing error as:
IOError:[Errno 2] No such file or directory: '/storage/emulated/0/com.hipipal.qpyplus/script3/File1.txt'
1|uo_a116#cancro:/ $
Is the above statement correct?
fob=open('File1.txt','r')
Is not working in version 1.0.4.
fout=open('File2.txt','w')
Was working on version 0.9.6, but is not working in 1.0.4.
The "error" is Read only file system.
It looks like restrictions in the (new 1.0.4) file system library. I post a mail to the editor, but no answer at this time.
For testing, try to write absolute path to your files pointing, for example, to sdcard (/sdcard/out.txt).
I had problems on this versions (>=1.0.4) because launch process of script changes and execution directory is not the same as script directory.
I had to change my scripts to point to absolute paths.
It was tested with qpython developer.
Check this link:
https://github.com/qpython-android/qpython.org/issues/48
You can also try as simple as:
fob=open('File1.txt','r')
fob.read()
Just if the script is in the same folder of the file.
You can change the current working directory to path with script before read file:
import os
os.chdir(os.path.dirname(os.path.abspath(__file__)))
I'm trying to get PhoneGap working. I've hit a hurdle getting started.
I've downloaded version 0.9.1. I've been following the instructions at http://phonegap.pbworks.com/Getting-started-with-Android-PhoneGap-in-Eclipse
Using MacOS 10.5.8. Android SDK is already installed and working with Eclipse.
My .bash_profile file looks like this:-
$PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin
export PATH=${PATH}:/Applications/android-sdk-mac_86/tools
export PATH=$PATH:/Applications/phonegap-android/bin
(and I restarted my terminal window to make it take effect)
I've tried the following command:-
cd /Applications/phonegap-android/bin
ruby ./droidgap /Applications/android-sdk-mac_86 HelloPhoneGap com.myidentity.android /Users/myidentity/Documents/workspace/HelloPhoneGap/assets/www /Users/myidentity/Desktop
...and I get the following error:-
./droidgap:4:in `require': no such file to load -- /Applications/phonegap-android/bin/lib/generate.rb (LoadError)
from ./droidgap:4
Why?
I ran into this issue as well, move droidgap up one level into the phonegap base directory.
Or, you should mention the complete path:
export PATH=$path: /Applications/phonegap-android/bin/**droidgap**
I came across such issues too. go to https://github.com/jonathanstark/phonegap-android, search the generate.rb file in the lib folder there, download it, then you are good to go.