Android and Arduino: ADK issues

Discussion in 'Android' started by Mariam, Mar 25, 2016.

  1. Mariam

    Mariam New Member

    Joined:
    Mar 20, 2016
    Messages:
    10
    Likes Received:
    1
    Hi,
    I have tried several times the Android and Arduino Hello World Tutorial in different ways , using both ADKToolkit 0.2.0 and the latest ADKToolkit 0.3.0 from https://github.com/palazzem/adk-toolkit. See my previous post http://www.udoo.org/forum/threads/a...rld-tutorial-null-point-exception-error.3744/

    The Arduino sketch works perfect but I am having trouble running the Android program. While running the app , the layout appears but once the button is clicked the app crashes (I have tried toggle button, switch, image View and button) . The log shows Null pointer Exception caused by this particular line all the time

    adkManager.write("1"); // the function write is used in ADKToolkit 0.3.0 instead of writeSerial from the previous version.

    How can you avoid this error?? Is there something missing in the adkManger class of the ADKtoolkit ? or the write function( derived from OutputStream class) be replaced by some other function??
     
  2. Tyler Vaught

    Tyler Vaught New Member

    Joined:
    Feb 6, 2016
    Messages:
    9
    Likes Received:
    1
    I just had this problem last night using my Dual and the Hello World Tutorial. What I did was, was download the original files and used the adk-toolkit 0.2.0 and last night it was giving me all kinds of wierd errors of why it couldn't run and then I upgraded to Android Studio 2.0 and magically it worked. However in my manifest I changed it from "uses-feature android:name="android.hardware.usb.accessory" " to " uses-feature android:name="android.hardware.Usb.Accessory" " and haven't had any issues since.
     
    Sus454 likes this.
  3. Mariam

    Mariam New Member

    Joined:
    Mar 20, 2016
    Messages:
    10
    Likes Received:
    1
    Hi, thanks for your suggestion, I will try that, was your app successful in making the LED blink as well ?
     
  4. Tyler Vaught

    Tyler Vaught New Member

    Joined:
    Feb 6, 2016
    Messages:
    9
    Likes Received:
    1
    Yeah once I did that it ran no problem. Just remember to import it into Android Studio using "Import Project" instead of "Open Existing Project" because the Udoo creators made this app with Eclipse and not Android Studio.
     
  5. Mariam

    Mariam New Member

    Joined:
    Mar 20, 2016
    Messages:
    10
    Likes Received:
    1
    I ran the project by importing to Android Studio 2.0, unfortunately it again shows a null pointer exception when the turn on button is clicked. I dont know how it worked for you.

    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.FileOutputStream.write(byte[])' on a null object reference
    at me.palazzetti.adktoolkit.AdkManager.writeSerial(AdkManager.java:113)
    at org.udoo.androidadkdemo.UDOOBlinkLEDActivity.blinkLED(UDOOBlinkLEDActivity.java:57)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at android.view.View$1.onClick(View.java:4015)
    at android.view.View.performClick(View.java:4780)
    at android.widget.CompoundButton.performClick(CompoundButton.java:120)
    at android.view.View$PerformClick.run(View.java:19866)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5254)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
     
  6. Tyler Vaught

    Tyler Vaught New Member

    Joined:
    Feb 6, 2016
    Messages:
    9
    Likes Received:
    1
    I'm not at home right now but later today I'll upload my files that compiled and ran correctly


    Sent from my iPhone using Tapatalk
     
  7. Mariam

    Mariam New Member

    Joined:
    Mar 20, 2016
    Messages:
    10
    Likes Received:
    1
    Adk toolkit doesn't seem to work for me . So made the whole code from scratch , referring to other websites, it works now , phew ..led blinks too .
    Thanks anyways.
     
  8. Mariam

    Mariam New Member

    Joined:
    Mar 20, 2016
    Messages:
    10
    Likes Received:
    1
    delba likes this.

Share This Page