All,

My apologies ... I initially thought the cause of the crash was the 
communication between the MainActivity and the BoundServer.

As it turns out, the reason of the crash is *AppCompatActivity*. When I 
changed it to *Activity*, the app ran without a problem.

I am now working on getting the example to work with AppCompatActivity ... 
If anybody has any suggestion, that would be greatly appreciated   :-)


On Monday, March 30, 2020 at 10:54:47 AM UTC-4, Vincenzo Pappano wrote:
>
>
> I am experimenting with this example.
>
> https://www.truiton.com/2014/11/bound-service-example-android/
>
> It only has two java classes
>
> 1. BoundService.java ("class BoundService extends service") that 
> instantiates a chronometer and returns the time elapsed since the service 
> was started
>
> 2. MainActivity.java, which starts the service and binds to it.
>
> The code compiles on a Windows PC, using Android Studio. I can install and 
> run the apk file on my dedicated embedded android target. The app runs fine.
>
> I would like to be able to compile the example the code on a Linux server 
> running Ubuntu. The server has been setup to run AOSP. Specifically I would 
> like to build the app from source code in the */packages/apps/* folder 
> using a dedicated Android.mk file
>
> The cleaned-up directory structure is given below
>
> \---src
> |   Android.mk
> |   AndroidManifest.xml
> |
> +---java
> |   \---com
> |       \---example
> |           \---chrono
> |                   BoundService.java
> |                   MainActivity.java
> |
> \---res
>     +---drawable
>     +---drawable-v24
>     +---layout
>     +---mipmap-anydpi-v26
>     +---mipmap-hdpi
>     +---mipmap-mdpi
>     +---mipmap-xhdpi
>     +---mipmap-xxhdpi
>     +---mipmap-xxxhdpi
>     \---values
>
> The code is successfully compiled into a .APK file ("mm -B -j4"). I can 
> install the APK file (adb install my_app.apk). However, when I run the app, 
> the app crashes "My_App has stopped"
>
> The Android.mk file is given below
>
> LOCAL_PATH := $(call my-dir)
>
> include $(CLEAR_VARS)
>
> LOCAL_STATIC_JAVA_LIBRARIES := android-common
> LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4
> LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat
> LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-gridlayout
>
> LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
> LOCAL_RESOURCE_DIR += prebuilts/sdk/current/support/
> v7/appcompat/res
> LOCAL_RESOURCE_DIR += prebuilts/sdk/current/support/v7/gridlayout/res
>
> LOCAL_PACKAGE_NAME := BoundService
> LOCAL_SRC_FILES := $(call all-java-files-under, src)
> LOCAL_MODULE_TAGS := tests
>
> LOCAL_AAPT_FLAGS := --auto-add-overlay
> LOCAL_AAPT_FLAGS += --extra-packages 
> android.support.v7.appcompat:android.support.v7.gridlayout:android.common:android.support.v4
>
> include $(BUILD_PACKAGE)
>
>
>
> The android manifest file is given below
>
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <manifest package="com.example.chrono"
>           xmlns:android="http://schemas.android.com/apk/res/android";
>           android:versionCode="1"
>           android:versionName="1.0">
>
>     <uses-sdk
>         android:minSdkVersion="25"
>         android:targetSdkVersion="25" />
>
>     <application
>         android:allowBackup="true"
>         android:icon="@drawable/ic_launcher"
>         android:label="@string/app_name"
>         android:theme="@style/AppTheme">
>         <activity
>             android:name=".MainActivity"
>             android:label="@string/app_name">
>             <intent-filter>
>                 <action android:name="android.intent.action.MAIN"/>
>
>                 <category android:name="android.intent.category.LAUNCHER"/>
>             </intent-filter>
>         </activity>
>
>         <service android:name=".BoundService">
>         </service>
>     </application>
>
> </manifest>
>
>
>
> The app runs if compiled through Android Studio on my Windows PC, but it 
> doesn't if I compile on the Ubuntu machine using AOSP and the command line. 
> I am missing something in the "translation". Where is my problem? 
> Android.mk? AndroidManifest.xml? Somewhere else?
>
> Thanks !!!
>

-- 
-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

--- 
You received this message because you are subscribed to the Google Groups 
"android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-porting+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-porting/468833f9-7c39-4f84-acc7-7c69b14bdd67%40googlegroups.com.

Reply via email to