I forgot to add the code used to test it:
if(cn != null && cn.isSupported()) {
rv = cn.doInNative("string");
Log.p(rv);
}
which returns "Dummy" as expected.
-------------------
On Wednesday, June 23, 2021 at 6:15:12 PM UTC-4 Dennis Rogers wrote:
> I'm at a loss in trying to do a native interface. I created the class
> "MyNative"
>
> package com.symdesign.myapp;
>
> import com.codename1.system.NativeInterface;
>
> public interface MyNative extends NativeInterface {
> public String doInNative(String hi);
> }
>
> Then I ran the tool "create native interfaces" which created the file
> "MyNativeImpl.java" in the javase folder which
> I modified to:
>
> package com.symdesign.myapp;
>
> public class MyNativeImpl implements com.symdesign.shoppinggenie.MyNative{
> public String doInNative(String param) {
> return "Dummy";
> }
>
> public boolean isSupported() {
> return true;
> }
> }
>
> If I run this in the simulator it seems to work ok, but when I compile it
> to the cloud I get an error file with the error at the top:
>
> Found hyp.beamId
> Tried to start hyperlog but failed: Failed to start hyperlog: Cannot run
> program "hyp": error=2, No such file or directory
> User-level: 9000
> Request Args:
> -----------------
> build.incSources=1
> hyp.beamId=9cfefcf3-f2c3-467c-b459-83c8c6dc3181
> ios.includePush=true
> java.version=8
> maven.codenameone-maven-plugin=7.0.26
> ios.newStorageLocation=true
> maven.codenameone-core.version=7.0.26
> android.release=false
> android.debug=true
> -------------------
> .
> .
> On Wednesday, June 16, 2021 at 12:18:48 PM UTC-4 Dennis Rogers wrote:
>
>> Thanks, but that didn't seem to help. I don't get any errors when
>> building the app. I get these errors when trying to load it onto the phone:
>>
>> $ adb install -i ShoppingGenie-debug.apk
>>
>> Performing Streamed Install
>> adb: failed to install ShoppingGenie-debug.apk: Error: Unable to open
>> file: 8370465
>> Consider using a file under /data/local/tmp/
>> Error: Can't open file: 8370465
>>
>> Exception occurred while executing:
>> java.lang.IllegalArgumentException: Error: Can't open file: 8370465
>> at
>> com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:461)
>> at
>> com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:1060)
>> at
>> com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:169)
>> at android.os.ShellCommand.exec(ShellCommand.java:104)
>> at
>> com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21745)
>> at android.os.Binder.shellCommand(Binder.java:881)
>> at android.os.Binder.onTransact(Binder.java:765)
>> at
>> android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4860)
>> at
>> com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4015)
>> at android.os.Binder.execTransactInternal(Binder.java:1021)
>> at android.os.Binder.execTransact(Binder.java:994)
>>
>>
>> On Wednesday, June 16, 2021 at 8:02:59 AM UTC-4 Steve Hannah wrote:
>>
>>> Add the following to the dependences section of your javase/pom.xml file:
>>>
>>> <dependency>
>>> <groupId>com.codenameone</groupId>
>>> <artifactId>codenameone-core</artifactId>
>>> <scope>provided</scope>
>>> </dependency>
>>>
>>>
>>> That should fix the issue. (Mind you you haven't shared any error messages
>>> so it's hard to say what your specific problem is).
>>>
>>>
>>> Steve
>>>
>>>
>>> On Tue, Jun 15, 2021 at 9:30 PM Dennis Rogers <[email protected]> wrote:
>>>
>>>> Since I added the generated the native interface I can no longer do
>>>> cloud builds. Is there a way I can remove the native interface I created
>>>> for the moment?
>>>>
>>>> On Monday, June 14, 2021 at 10:09:56 PM UTC-4 Shai Almog wrote:
>>>>
>>>>> That sounds like a bug in the maven project. Let me check.
>>>>>
>>>>> On Tuesday, June 15, 2021 at 12:00:09 AM UTC+3 [email protected]
>>>>> wrote:
>>>>>
>>>>>> Sorry but I'm a little confused. I created a file, MyNative.java, in
>>>>>> the common folder along with my other code:
>>>>>>
>>>>>> package com.symdesign.shoppinggenie;
>>>>>>
>>>>>> import com.codename1.system.NativeInterface;
>>>>>> public interface MyNative extends NativeInterface {
>>>>>> String helloWorld(String hi);
>>>>>> }
>>>>>>
>>>>>> When I run "Generate Native Interfaces" I get the error "cannot
>>>>>> access com.codename1.system.NativeInterface" but nevertheless
>>>>>> it creates a file in MyProject/src/main/java/com.symdesign/myproject/
>>>>>> called MyNativeImpl.java which looks like the advertised stub. (Is it in
>>>>>> this file that I should put my native code? )
>>>>>>
>>>>>>
>>>>>> On Sunday, June 13, 2021 at 9:37:18 PM UTC-4 Shai Almog wrote:
>>>>>>
>>>>>>> On which file?
>>>>>>> notice that the native side shouldn't include the native interface,
>>>>>>> it should only be in common.
>>>>>>>
>>>>>>> On Monday, June 14, 2021 at 1:08:30 AM UTC+3 [email protected]
>>>>>>> wrote:
>>>>>>>
>>>>>>>> I generated the native interface but when I try to build it, it
>>>>>>>> says it can't find com.codename1.system.NativeInterface.
>>>>>>>>
>>>>>>>> On Saturday, June 12, 2021 at 9:41:08 PM UTC-4 Shai Almog wrote:
>>>>>>>>
>>>>>>>>> The plugin is only applicable to Ant projects not to maven
>>>>>>>>> projects.
>>>>>>>>> For maven Generate Native Interfaces is one of the run
>>>>>>>>> configurations.
>>>>>>>>> On Sunday, June 13, 2021 at 12:01:09 AM UTC+3 [email protected]
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> I'm trying to create a native interface to access android's
>>>>>>>>>> SpeechRecognitionHelper. Following the manual I created andinterface
>>>>>>>>>> that
>>>>>>>>>> extends NativeInterface i.e.
>>>>>>>>>>
>>>>>>>>>> import com.codename1.system.NativeInterface;
>>>>>>>>>>
>>>>>>>>>> public interface MyNative extends NativeInterface {
>>>>>>>>>> String getSpeech(String hi);
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> The manual then says I can generate initial native code by right
>>>>>>>>>> clicking on the interface and selecting "Generate Native Access" .
>>>>>>>>>> This
>>>>>>>>>> option doesn't seem to be available in my setup and I don't know
>>>>>>>>>> where to
>>>>>>>>>> go from here.
>>>>>>>>>>
>>>>>>>>>> -Dennis
>>>>>>>>>>
>>>>>>>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "CodenameOne Discussions" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/codenameone-discussions/5676afcc-c439-4018-a258-573ffc9fb6f6n%40googlegroups.com
>>>>
>>>> <https://groups.google.com/d/msgid/codenameone-discussions/5676afcc-c439-4018-a258-573ffc9fb6f6n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>>
>>> --
>>> Steve Hannah
>>> Software Developer
>>> Codename One
>>> http://www.codenameone.com
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/ad74be62-dcd3-499a-bf22-323d8c89327an%40googlegroups.com.