eugals / GTKAndroid

GTK+Android
Other
91 stars 23 forks source link

i can not build native app #1

Closed liulover5 closed 9 years ago

liulover5 commented 9 years ago

i can build share lib libgtka_test.so, when i build native c app(only use c called gtk api), when it links share lib libgtka_test.so ,

it delates libgtka_test.so then link failed , can u provide an example ? , tks a lot

notes: i use win7 with android-ndk-r10b i pray you can understand what i say ,poor en...

/////////////////////////////////////////////////Android.mk////////////////////////////////////////////////////////////////////////// /////////////main.c get from your app/jni, i add a main func ,call func android_main ///////////////////////////

# This file is only used at AOSP usage. (not NDK usage)
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_CFLAGS += -pie -fPIE
LOCAL_LDFLAGS += -pie -fPIE

#######################################################

LOCAL_C_INCLUDES += D:\android-ndk-r10b\sources\android\native_app_glue
LOCAL_C_INCLUDES += D:\android-ndk-r10b\platforms\android-19\arch-arm\usr\include
LOCAL_C_INCLUDES += E:\ANDROID_NDK_PROJECT\GTKAndroid-master\clibs\gtk\include
LOCAL_C_INCLUDES += E:\ANDROID_NDK_PROJECT\GTKAndroid-master\clibs\gtk\distsrc
LOCAL_C_INCLUDES += E:\ANDROID_NDK_PROJECT\GTKAndroid-master\clibs\glib\distsrc\glib
LOCAL_C_INCLUDES += E:\ANDROID_NDK_PROJECT\GTKAndroid-master\clibs\glib\distsrc
LOCAL_C_INCLUDES += E:\ANDROID_NDK_PROJECT\GTKAndroid-master\clibs\glib\include
LOCAL_C_INCLUDES += E:\ANDROID_NDK_PROJECT\GTKAndroid-master\clibs\glib\distsrc\gmodule
LOCAL_C_INCLUDES += E:\ANDROID_NDK_PROJECT\GTKAndroid-master\clibs\glib\distsrc\gmodule
LOCAL_C_INCLUDES += E:\ANDROID_NDK_PROJECT\GTKAndroid-master\clibs\pango\distsrc
LOCAL_C_INCLUDES += E:\ANDROID_NDK_PROJECT\GTKAndroid-master\clibs\cairo\distsrc\cairo\src
LOCAL_C_INCLUDES += E:\ANDROID_NDK_PROJECT\GTKAndroid-master\clibs\cairo\cairo-extra
LOCAL_C_INCLUDES += E:\ANDROID_NDK_PROJECT\GTKAndroid-master\clibs\gdk-pixbuf\distsrc
LOCAL_C_INCLUDES += E:\ANDROID_NDK_PROJECT\GTKAndroid-master\clibs\atk\distsrc

#LOCAL_MODULE_TAGS := optional

#######################################################

#LOCAL_LDLIBS += -L$(LOCAL_PATH)/../../usr/lib -lc
#LOCAL_LDLIBS += -L$(LOCAL_PATH)/../../usr/lib -lstdc++
#LOCAL_LDLIBS += -LE:\ANDROID_NDK_PROJECT\GTKAndroid-master\app_me\libs\armeabi -lgtka_test

#######################################################

LOCAL_MODULE    := gtka_test
LOCAL_SRC_FILES := main.c

#LOCAL_MODULE_TAGS := optional

#include $(BUILD_SHARED_LIBRARY)
include $(BUILD_EXECUTABLE)

#######################################################

#include $(LOCAL_PATH)/Android_gl2_copyTexImage.mk

#######################################################
eugals commented 9 years ago

Hi @liulover5,

it delates libgtka_test.so then failed

What does this mean? Did you get any error message you could quote here? (I tried Win7 and ndk-r10b with these sources some time ago and everything worked well then)

can u provide an example

Did you follow these instructions?

eugals commented 9 years ago

This file is only used at AOSP

My sources are supposed to be built within NDK only, sorry. Anyway, I can't give any advice, until you quote the compilation errors here. Please do this.

liulover5 commented 9 years ago

it delates libgtka_test.so then failed ---->> What does this mean? it is ok ,its my false ...

i build ,as your instructions, but without SDK,...

tks ...i want to build native running app only using NDK,, i need to try more.....

liulover5 commented 9 years ago

E:\ANDROID_NDK_PROJECT\GTKAndroid\app>..\gradlew :app:help Welcome to Gradle 2.2.1. To run a build, run gradlew ... To see a list of available tasks, run gradlew tasks To see a list of command-line options, run gradlew --help BUILD SUCCESSFUL Total time: 6.256 secs E:\ANDROID_NDK_PROJECT\GTKAndroid\app>

i can not find app-debug.apk ?????????????? // why

eugals commented 9 years ago

i can not find app-debug.apk ?????????????? // why

Did you check in E:\ANDROID_NDK_PROJECT\GTKAndroid\app\build\outputs\apk?

eugals commented 9 years ago

Oops, I missed this debug in the apk name, sorry. To build app-debug.apk you should run this command:

..\gradlew assembleDebug

I'll update the build instructions

liulover5 commented 9 years ago

tks very much ... i have BUILD SUCCESSFUL and get app-debug.apk for ver 5.1 and 4.4.2
and running ok on 4.4.2 , show sayhello on screen

i will report u a bug when i build for api 19 (4.4.2 ) , this file will meet an error E:\ANDROID_NDK_PROJECT\GTKAndroid\app\src\main\res\values-v21\styles.xml

maybe android 4.4.2 do not surpport this style

///////////////////////////////////////////////////////////////////////////////////////// please look log ///////////////////////////////////////////////////////////////////////////////////////// E:\ANDROID_NDK_PROJECT\GTKAndroid\app>..\gradlew assembleDebug :app:preBuild :app:compileDebugNdk UP-TO-DATE :app:preDebugBuild :app:checkDebugManifest :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources :app:processDebugManifest UP-TO-DATE :app:processDebugResources E:\ANDROID_NDK_PROJECT\GTKAndroid\app\build\intermediates\res\debug\values-v21\v alues.xml:5: error: Error retrieving parent for item: No resource found that mat ches the given name 'android:Theme.Material.Light'. :app:processDebugResources FAILED

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 6.343 secs

E:\ANDROID_NDK_PROJECT\GTKAndroid\app>

eugals commented 9 years ago

Thanks for the feedback!

Hmm, this res\values-v21\styles.xml is not supposed to be used when building for API v19. There is res\values\styles.xml instead.

How were you building this 4.4.2 version? Did you modify build.gradle somehow? minSdkVersion is set to 15, so the "5.1 APK" should work well on all 4.0.3+ Androids too. No need to build separate binaries for them.

liulover5 commented 9 years ago

i know res\values-v21\styles.xml is not is not supposed to be used when building for API v19 , but i build API V19 ,it can find this file and build error ( error on the previous quote )....

actually ,when build for V19 should not detect this file and happen this error

tips: i think you can lead this project out of JVM (do not use apk to call gtk C func by jni), you can build native binary app , using C/S architecture ,for eg: surfaceflinger is server , gtk is client (software draw UI),
I have test client app ( skia/opengl ES draw UI) connect server (surfaceflinger) draw view, gtk software draw UI same as software skia / hard opengl ES draw UI ,

i modefy build.gradle for 4.4.2 version(API v19) :

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

apply plugin: 'com.android.application'

android { compileSdkVersion 19 buildToolsVersion "19.1"

defaultConfig {
    applicationId "org.p2lang.gtkandroid"
    minSdkVersion 15
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
    }
    debug {
        jniDebuggable true
    }
}

sourceSets.main {
    jniLibs.srcDir 'libs'
    manifest.srcFile 'AndroidManifest.xml'
    // adding gtk.css and other ndk-build non-*.so artifacts
    assets.srcDirs = [assets.srcDirs, "libs/assets"]
}

}

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) }

eugals commented 9 years ago

i modefy build.gradle for 4.4.2 version(API v19)

Ah, I see. Well, I don't think this is a major issue. This file shouldn't be modified to build the app working under 4.4.2.

Thanks for your feedback @liulover5