How to fix 'class android::Surface' has no member named 'setDirtyRect'? - android

While building Android (OmniRom, based on 5.1) I've got this:
target thumb C++: libandroid_runtime <= frameworks/base/core/jni/android_view_InputQueue.cpp
frameworks/base/core/jni/android_view_Surface.cpp: In function 'void android::nativeSetDirtyRect(JNIEnv*, jclass, jlong, jobject)':
frameworks/base/core/jni/android_view_Surface.cpp:211:14: error: 'class android::Surface' has no member named 'setDirtyRect'
surface->setDirtyRect(&rect);
^
target thumb C++: libandroid_runtime <= frameworks/base/core/jni/android_view_KeyEvent.cpp
target thumb C++: libandroid_runtime <= frameworks/base/core/jni/android_view_KeyCharacterMap.cpp
make: *** [/home/ice552/omni/out/target/product/find7op/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/android_view_Surface.o] Ошибка 1
make: *** Ожидание завершения заданий...
How to fix this?

Building 5.1 for CAF devices is not yet possible.
You also need to use branch android-5.1-caf for av and native repos

You need to apply these two patches to frameworks/native: http://review.cyanogenmod.org/#/c/62472/2 https://gerrit.omnirom.org/#/c/11061/1/
Recovery will also throw an error, so you need to add graphics from 5.0.

Related

Build command failed on telegram

I got this error on the last version of the telegram.
telegram source code version: 4.9.0
envirement :
ubuntu 17.10.0
android studio:3.2 canary 9
ndk version: 14.1.3816874
[armeabi-v7a] Compile++ arm : tmessages.28 <= TgNetWrapper.cpp
/home/joker/telegram490/TMessagesProj/jni/./jni.c: In function
'listdir':
/home/joker/telegram490/TMessagesProj/jni/./jni.c:193:31: error:
'struct stat' has no member named 'st_atim'
if (attrib.st_atim.tv_sec != 0) {
^
/home/joker/telegram490/TMessagesProj/jni/./jni.c:194:35: error:
'struct stat' has no member named 'st_atim'
if (attrib.st_atim.tv_sec < time) {
^
/home/joker/telegram490/TMessagesProj/jni/./jni.c:198:35: error:
'struct stat' has no member named 'st_mtim'
if (attrib.st_mtim.tv_sec < time) {
^make: ***
[/home/joker/telegram490/TMessagesProj/build/intermediates
/ndkBuild/afat/
debug/obj/local/armeabi-v7a/objs-debug/tmessages.28/./jni.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from
/home/joker/telegram490/TMessagesProj/jni/./tgnet/TLObject.h:13:0,
from
/home/joker/telegram490/TMessagesProj/jni/./tgnet/ApiScheme.h:15,
from
/home/joker/telegram490/TMessagesProj/jni/./TgNetWrapper.cpp:2:
/home/joker/telegram490/TMessagesProj/jni/./tgnet/Defines.h: In
function 'std::string to_string_uint64(uint64_t)':
/home/joker/telegram490/TMessagesProj/jni/./tgnet/Defines.h:184:32:
error: expected ')' before 'PRIu64'
int len = sprintf(buf, "%" PRIu64, value);
Edit:
thanks to #anubhav-gupta, Through SDK Manager, I can only upgrade to version r18-beta1.
after the upgrade I face up with this error:
Android NDK: APP_STL gnustl_static is no longer supported. Please switch to either c++_static or c++_shared
Edit:
update NDK to r15 and The problem was solved.
The main problem is in this line 'struct stat' has no member named 'st_atim'
If you're using a modern version of the NDK, you'll have a modern struct stat: https://android.googlesource.com/platform/bionic/+/master/libc/include/sys/stat.h
Note that you need to be using the NDK's unified headers to get the up to date headers. This is the default in r15, but opt-in for r14.

error when updated libpng for cocos2d-x

i have problem when replace fixed libpng. i used cocos2d1.0.1-x-0.13.0-beta/ndkr8
Compile++ thumb : cocos2dx_static <= CCFileUtils.cpp
Compile++ thumb : cocos2dx_static <= CCGL.cpp
Compile++ thumb : cocos2dx_static <= CCImage.cpp
C:/Users/trach/Pictures/cocos2d-1.0.1-x-0.13.0-beta/cocos2dx/platform/CCImage.cpp: In member function 'bool cocos2d::CCImage::_initWithPngData(void, int)':
C:/Users/trach/Pictures/cocos2d-1.0.1-x-0.13.0-beta/cocos2dx/platform/CCImage.cpp:257:33: error: invalid use of incomplete type 'png_info {aka struct png_info_def}'
C:/Users/trach/Pictures/cocos2d-1.0.1-x-0.13.0-beta/cocos2dx/platform/third_party/android/prebuilt/libpng/include/png.h:594:16: error: forward declaration of 'png_info {aka struct png_info_def}'
make: ** [/cygdrive/c/Users/trach/Pictures/android-ndk-r8e/build/core/build-binary.mk:273: obj/local/armeabi/objs/cocos2dx_static/platform/CCImage.o] Error 1
make: Leaving directory '/cygdrive/c/Users/trach/Pictures/cocos2d-1.0.1-x-0.13.0-beta/show_entry'
cp: cannot create regular file '/cygdrive/c/Users/trach/Pictures/cocos2d-1.0.1-x-0.13.0-beta/show_entry/jni/../libs/armeabi': No such file or directory
libpng-1.5 and later do not allow direct access to the members of png_ptr, so you have to replace things like
png_info->width
png_ptr->width
with things like
png_get_image_width(png_ptr,png_info)
in your application, or downgrade libpng to the latest 1.2.x version.

Android NDK and functional (std::function) support

I tried to use std::function in my project, having read here and there that C++ 11 is quite well supported. However simply using std::function makes the build fail:
[armeabi] Compile++ thumb: MyAppNative <= MyAppNative.cpp
jni/MyAppNative.cpp: In function 'jint JNI_OnLoad(JavaVM*, void*)':
jni/MyAppNative.cpp:7:2: error: 'function' is not a member of 'std'
std::function<void()> func;
^
jni/MyAppNative.cpp:7:24: error: 'func' was not declared in this scope
std::function<void()> func;
^
make: *** [obj/local/armeabi/objs/MyAppNative/MyAppNative.o] Error 1
My question is: is std::function supposed to be supported? I've seen it conditionally defined in the header, depending on _STLP_USE_BOOST_SUPPORT. Is that normal? I have attached a sample project if anyone is interested in testing.
http://www.filedropper.com/cpp11-functional-issue
Cheers
STLport, which you seem to be using, has never had C++11 support.
See developer.android.com/ndk/guides/cpp-support.html at "How to set your runtime" and choose a different one (gnustl_static or c++_static).
Ok so thanks to Christian and Alex, the answer is indeed to change your Application.mk so that it references gnustl_static.
APP_STL := gnustl_static
Thank you all!

Assembler Messages: Branch out of range

I'm developing game on cocos2d-x with C++.
I developed whole code in xCode. compiled, run in iphone and ipad, run as expected.
But when compiling code for android in windows 7 OS, using Cygwin (64-bit)..I encounterd following code..
$ ./build_native.sh
NDK_ROOT = D:\android-ndk-r9
COCOS2DX_ROOT = /cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android/../../..
APP_ROOT = /cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android/..
APP_ANDROID_ROOT = /cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android
Using prebuilt externals
make: Entering directory '/cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android'
Android NDK: WARNING:/cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android/../../../cocos2dx/Android.mk:cocos2dx_static: LOCAL_LDLIBS is always ignored for static libraries
Compile++ thumb : cocos2dcpp_shared <= AppDelegate.cpp
Compile++ thumb : cocos2dcpp_shared <= PlayerSelection.cpp
jni/../../Classes/PlayerSelection.cpp: In member function 'void PlayerSelection::update()':
jni/../../Classes/PlayerSelection.cpp:1511:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Compile++ thumb : cocos2dcpp_shared <= GameScene.cpp
C:\cygwin64\tmp\ccdF8Sjo.s: Assembler messages:
C:\cygwin64\tmp\ccdF8Sjo.s:12180: Error: branch out of range
/cygdrive/d/android-ndk-r9/build/core/build-binary.mk:348: recipe for target 'obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/GameScene.o' failed
make: *** [obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/GameScene.o] Error 1
make: Leaving directory '/cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android'
In the Above command-line output the problem is:
Compile++ thumb : cocos2dcpp_shared <= GameScene.cpp
C:\cygwin64\tmp\ccdF8Sjo.s: Assembler messages:
C:\cygwin64\tmp\ccdF8Sjo.s:12180: Error: branch out of range
I tried Following links:
Why does branching occur in assembly code while comparing for a number to be in range?
https://in.answers.yahoo.com/question/index?qid=20100603163224AAAGX7J
branch out of range compile error
None of above references were helpfull that I could compile code.
After battling with my code by checking each function ONE by ONE, I found the problem was lying in nested switch case, if anyone happen to hit this problem this could be it..
And thank you LearnCocos2D for Your interest.

android source build fails: undeclared identifier 'ftruncate'

I wanted to build the android source code by using this documentation:
https://source.android.com/source/building-running.html
last step was: 'make -j16'
After a while the compilation is aborted with the following error message:
host C++: libart <= art/runtime/catch_block_stack_visitor.cc
host C++: libart <= art/runtime/catch_finder.cc
art/compiler/elf_stripper.cc:122:16: error: use of undeclared identifier 'ftruncate'
int result = ftruncate(file->Fd(), offset);
^
1 error generated.
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libart-compiler_intermediates/elf_stripper.o] Fehler 1
make: *** Warte auf noch nicht beendete Prozesse...
I have no idea.
Google did not help and I am really not into this topic, just wanted to do a little change to the android code (I have not changed anything yet).
My system is:
ubuntu 13.10
java 1.6.0_4
current android master branch
You could avoid this problem by adding
#include <unistd.h>
at the beginning of elf_stripper.cc

Categories

Resources