build JNI C code fail ???

by Keroro » Mon, 27 Apr 2009 16:23:49 GMT


Sponsored Links
 Why build error?

build and Error Message:
.../mydroid$ make libmax
target thumb C: libmax <= development/max/max.c
development/max/max.c: In function 'Java_testdll_set':
development/max/max.c:7: error: parameter name omitted
development/max/max.c:7: error: parameter name omitted
make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/
libmax_intermediates/max.o] Error 1

code as follows:

max.c
=======================================================================
#include <jni.h>
JNIEXPORT void JNICALL Java_testdll_set (JNIEnv *, jclass, jint);

 int i = 0;

    JNIEXPORT void JNICALL Java_testdll_set (JNIEnv *, jclass, jint
j)
      {
       i = j;
      }
=======================================================================

Android.mk
================================
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \

    max.c

LOCAL_C_INCLUDES := \

    $(JNI_H_INCLUDE)

LOCAL_SHARED_LIBRARIES := \

    libutils

LOCAL_PRELINK_MODULE := false

LOCAL_MODULE := libmax

include $(BUILD_SHARED_LIBRARY)
==================================

--~--~---------~--~----~------------~-------~--~----~



build JNI C code fail ???

by Keroro » Mon, 27 Apr 2009 16:34:48 GMT


 build JNI C code fail ???

Why build error?

build and Error Message:
.../mydroid$ make libmax
target thumb C: libmax <= development/max/max.c
development/max/max.c: In function 'Java_testdll_set':
development/max/max.c:7: error: parameter name omitted
development/max/max.c:7: error: parameter name omitted
make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/
libmax_intermediates/max.o] Error 1

code as follows:

max.c
=======================================================================
#include <jni.h>
JNIEXPORT void JNICALL Java_testdll_set (JNIEnv *, jclass, jint);

 int i = 0;

    JNIEXPORT void JNICALL Java_testdll_set (JNIEnv *, jclass, jint
j)
      {
       i = j;
      }
=======================================================================

Android.mk
================================
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \

    max.c

LOCAL_C_INCLUDES := \

    $(JNI_H_INCLUDE)

LOCAL_SHARED_LIBRARIES := \

    libutils

LOCAL_PRELINK_MODULE := false

LOCAL_MODULE := libmax

include $(BUILD_SHARED_LIBRARY)
==================================

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


build JNI C code fail ???

by MrSnowflake » Mon, 27 Apr 2009 19:58:33 GMT


 Probably because JNI is not supported.



--~--~---------~--~----~------------~-------~--~----~



build JNI C code fail ???

by Michael MacDonald » Mon, 27 Apr 2009 23:32:03 GMT


 


You need to supply variable names for all your function parameters, not
just jinit j.




--~--~---------~--~----~------------~-------~--~----~



build JNI C code fail ???

by Keroro » Tue, 28 Apr 2009 20:42:52 GMT


 Thank you, have been solution.

On 47 119 Michael MacDonald <googlec...@antlersoft.com>




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Two suggestions for android's framework

Hi, all
I have 2 suggestions for android's framework.
1. Add a new attribute about rotation in Surface class, user can control
each surface's rotation according to it.
   I suggest google add a new attribute NO_ROTATION in
frameworks/base/core/java/android/view/Surface.java,  then check it in
LayerBase.cpp::validateVisibility(...) function to decide if re-calculate
the orientation and position for this layer(surface). So it will provide a
capability for user to control each surface's rotation.
  For example:
   Camera application's controller surface need rotate according to the
phone status(landscape or portrait), but its viewfinder surface needn't
rotate.
   In current android platform, we can correct it in
LayerBuffer::OverlaySource::onVisibilityResolved(), but it will prevent all
surfaces that use overlay to rotate, it isn't good method.

2. Add new interface function to set camera's parameters in MediaRecorder
class.
   MediaRecorder class hasn't interface function to set the camera's
parameters. For setting camera's parameters, we need use Camera class to
show preview screen and camera controller. When press capture key to record
the video, we need use MediaRecorder class, there are two method to do it:
 a. call Camera.release(), then call MediaRecorder class to record the
video. The method will cause black screen when press the start key, it can't
be accpected.
 b, MediaRecorder call setCamera(xxx), then record video. The method will
call CameraService::Client::startPreview(), and it will return by the
following sentence:
    // do nothing if preview is already started
    if (mHardware->previewEnabled()) return NO_ERROR;
   If call stopPreview here, it will cause black screen.
   In addition, we set callback function NULL when use camera to preview, if
we want to set new callback when press capture key, we need stopPreview
again, it also causes black screen.

        if ( mFrameCallbackFlag == FRAME_CALLBACK_FLAG_NOOP )
        {
            ret = mHardware->startPreview(NULL, mCameraService.get());
        }
        else*/
        {
            ret = mHardware->startPreview(previewCallback,
mCameraService.get());
        }

  So if add interface function in MediaRecorder class, we will fix all
problem.

  These are my suggestion, please give me your comments, thanks in advance.

Best regards
Feike

--~--~---------~--~----~------------~-------~--~----~

2. Do I need a dev handset, or can I develop using a standard G1 from T-Mobile?

None of those things are true in fact. The prerelease sdk they offered
didn't run on any device (yeah well..) and retail units can run "unsigned"
code (as the other poster said, its self-signed.)

You'll be at a pretty big disadvantage for using features from 1.5
('cupcake') or running on those devices, since the emulator (which is up to
date) is only sort of like the actual device. (1.0/1.1 sdk apps developed
with the emulator almost all had crashes/bugs/problems on phones. Plus some
things are missing - compass, sensors, bluetooth, etc. 1.5 is likely to be
the same way.)





--~--~---------~--~----~------------~-------~--~----~

3. ListView/ScrollView in new Widgets

4. SDK 1.5 released - A Couple Questions

5. Placing an array of buttons of varying length on the layout

6. Porting 1.0 to 1.5, map tiles stopped displaying

7. ADP 1.1 (JFv1.43_Holiday.zip) import contacts from SIM card crashes