I had enabled Address Sanitizer -> Detect use of stack after return in the run scheme. I then ran the app on iPad from Xcode directly and it worked. Then I closed the app, which terminated the debug session. Then I launched the app, but the app keep crashing. The crash log is below.

# Crashlytics - plaintext stacktrace downloaded by jsloop at Sat, 23 Feb 2019 11:53:58 GMT
# URL: https://fabric.io/MyApp2/ios/apps/com.MyApp.ios/issues/5c712d4bf8b88c2963d90087?time=last-seven-days/sessions/c5ae974ac57d4de9837d98337449c4a8_DNE_0_v2
# Organization: MyApp
# Platform: ios
# Application: MyApp
# Version: 1.2 (38)
# Bundle Identifier: com.MyApp.ios
# Issue #: 29
# Issue ID: 5c712d4bf8b88c2963d90087
# Session ID: c5ae974ac57d4de9837d98337449c4a8_DNE_0_v2
# Date: 2019-02-23T11:25:00Z
# OS Version: 12.0.0 (16A366)
# Device: iPad 5
# RAM Free: 9.8%
# Disk Free: 69.6%

#6. Crashed: Thread
0  libsystem_kernel.dylib                0x19cda1104 __pthread_kill + 8
1  libsystem_pthread.dylib               0x19ce1c0e0 pthread_kill$VARIANT$mp + 380
2  libsystem_c.dylib                     0x19ccf8d78 abort + 140
3  libclang_rt.asan_ios_dynamic.dylib    0x1018111d4 __sanitizer::Abort() + 62
4  libclang_rt.asan_ios_dynamic.dylib    0x10180f9cc __sanitizer::Die() + 174
5  libclang_rt.asan_ios_dynamic.dylib    0x1017f9790 __asan::AsanCheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) + 266
6  libclang_rt.asan_ios_dynamic.dylib    0x10180fa54 __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) + 120
7  libclang_rt.asan_ios_dynamic.dylib    0x1017fc370 __asan::AsanThread::SetThreadStackAndTls(__asan::AsanThread::InitOptions const*) + 238
8  libclang_rt.asan_ios_dynamic.dylib    0x1017fbf24 __asan::AsanThread::Init(__asan::AsanThread::InitOptions const*) + 96
9  libclang_rt.asan_ios_dynamic.dylib    0x1017fc394 __asan::AsanThread::ThreadStart(unsigned long long, __sanitizer::atomic_uintptr_t*) + 36
10 libsystem_pthread.dylib               0x19ce252fc _pthread_body + 128
11 libsystem_pthread.dylib               0x19ce2525c _pthread_start + 48
12 libsystem_pthread.dylib               0x19ce28d08 thread_start + 4

--

#0. com.apple.main-thread
0  libsystem_kernel.dylib         0x19cda19fc __ulock_wait + 8
1  libdispatch.dylib              0x19cbe5280 _dispatch_ulock_wait
2  libdispatch.dylib              0x19cbe51ec _dispatch_wait_on_address$VARIANT$mp
3  libdispatch.dylib              0x19cbe5c80 _dispatch_group_wait_slow
4  MyApp                           0x100e167a8 CLSContextInitialize + 772
5  MyApp                           0x100e139d0 -[CLSCrashReportingController installCrashReportingHandlers:] + 24
6  MyApp                           0x100e12cbc -[CLSCrashReportingController startCrashReporterWithAPIKey:betaToken:profilingMark:report:] + 620
7  MyApp                           0x100e128bc -[CLSCrashReportingController startWithProfilingMark:betaToken:] + 304
8  MyApp                           0x100e06cb0 __20-[Crashlytics start]_block_invoke + 628
9  libdispatch.dylib              0x19cc44484 _dispatch_client_callout
10 libdispatch.dylib              0x19cbe6710 _dispatch_once_callout
11 MyApp                           0x100e06a38 -[Crashlytics start] + 156
12 MyApp                           0x100e06e5c +[Crashlytics initializeIfNeeded] + 48
13 MyApp                           0x100e3c444 __15+[Fabric with:]_block_invoke + 524
14 libdispatch.dylib              0x19cc44484 _dispatch_client_callout
15 libdispatch.dylib              0x19cbe6710 _dispatch_once_callout
16 MyApp                           0x100e3c230 +[Fabric with:] + 228
17 MyApp                           0x100c7db88 AppDelegate.application(_:didFinishLaunchingWithOptions:) (AppDelegate.swift:23)
18 MyApp                           0x100c7e384 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) (<compiler-generated>)
19 UIKitCore                      0x1c98065f8 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 412
20 UIKitCore                      0x1c9807d60 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3340
21 UIKitCore                      0x1c980d7ac -[UIApplication _runWithMainScene:transitionContext:completion:] + 1552
22 UIKitCore                      0x1ca034db8 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 784
23 UIKitCore                      0x1ca031364 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 160
24 UIKitCore                      0x1ca034a34 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 240
25 UIKitCore                      0x1ca0353d4 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1076
26 UIKitCore                      0x1c9ff45fc __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 772
27 UIKitCore                      0x1c9ff42a8 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 432
28 UIKitCore                      0x1ca037844 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 220
29 UIKitCore                      0x1ca038334 _performActionsWithDelayForTransitionContext + 112
30 UIKitCore                      0x1ca0376fc -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 248
31 UIKitCore                      0x1ca030a10 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 368
32 UIKitCore                      0x1c980bca4 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 540
33 UIKitCore                      0x1c983d45c -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 364
34 (Missing)                      0x19fc3b890 (Missing)
35 (Missing)                      0x19fc46658 (Missing)
36 (Missing)                      0x19fc45d50 (Missing)
37 libdispatch.dylib              0x19cc44484 _dispatch_client_callout
38 libdispatch.dylib              0x19cbe7e58 _dispatch_block_invoke_direct$VARIANT$mp
39 (Missing)                      0x19fc7a640 (Missing)
40 (Missing)                      0x19fc7a2cc (Missing)
41 (Missing)                      0x19fc7a8e8 (Missing)
42 CoreFoundation                 0x19d19a5b8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
43 CoreFoundation                 0x19d19a538 __CFRunLoopDoSource0 + 88
44 CoreFoundation                 0x19d199e1c __CFRunLoopDoSources0 + 176
45 CoreFoundation                 0x19d194ce8 __CFRunLoopRun + 1040
46 CoreFoundation                 0x19d1945b8 CFRunLoopRunSpecific + 436
47 (Missing)                      0x19f408584 (Missing)
48 UIKitCore                      0x1c980f558 UIApplicationMain + 212
49 MyApp                           0x100c82880 main (AppDelegate.swift:16)
50 libdyld.dylib                  0x19cc54b94 start + 4

#1. com.apple.root.default-qos
0  libsystem_kernel.dylib                0x19cd95fd8 swtch_pri + 8
1  libsystem_pthread.dylib               0x19ce25f88 sched_yield + 16
2  libclang_rt.asan_ios_dynamic.dylib    0x101806c78 __sanitizer::internal_sched_yield() + 12
3  libclang_rt.asan_ios_dynamic.dylib    0x1017e9bb0 wrap_pthread_create + 272
4  MyApp                                  0x100e08d5c CLSMachExceptionInit + 756
5  libclang_rt.asan_ios_dynamic.dylib    0x1017efdf4 __wrap_dispatch_group_async_block_invoke + 208
6  libdispatch.dylib                     0x19cc436c8 _dispatch_call_block_and_release
7  libdispatch.dylib                     0x19cc44484 _dispatch_client_callout
8  libdispatch.dylib                     0x19cbe75e4 _dispatch_queue_override_invoke
9  libdispatch.dylib                     0x19cbf3a60 _dispatch_root_queue_drain
10 libdispatch.dylib                     0x19cbf4308 _dispatch_worker_thread2
11 libsystem_pthread.dylib               0x19ce26190 _pthread_wqthread + 472
12 libsystem_pthread.dylib               0x19ce28d00 start_wqthread + 4

#2. Thread
0  libsystem_kernel.dylib         0x19cda1b9c __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x19ce261d4 _pthread_wqthread + 540
2  libsystem_pthread.dylib        0x19ce28d00 start_wqthread + 4

#3. Thread
0  libsystem_pthread.dylib        0x19ce28cfc start_wqthread + 190

#4. com.twitter.crashlytics.ios.binary-images
0  libsystem_kernel.dylib                0x19cda3948 write + 8
1  libclang_rt.asan_ios_dynamic.dylib    0x1017c08d4 wrap_write + 108
2  MyApp                                  0x100e1dcc8 CLSFileLoopWithWriteBlock + 56
3  MyApp                                  0x100e1df34 CLSFileWriteToFileDescriptorOrBuffer + 212
4  MyApp                                  0x100e1e334 CLSFileWriteStringWithSuffix + 180
5  MyApp                                  0x100e1e424 CLSFileWriteHashEntryString + 36
6  MyApp                                  0x100e052ec __CLSBinaryImageChanged_block_invoke + 176
7  libclang_rt.asan_ios_dynamic.dylib    0x1017efc18 __wrap_dispatch_async_block_invoke + 208
8  libdispatch.dylib                     0x19cc436c8 _dispatch_call_block_and_release
9  libdispatch.dylib                     0x19cc44484 _dispatch_client_callout
10 libdispatch.dylib                     0x19cbebc18 _dispatch_lane_serial_drain$VARIANT$mp
11 libdispatch.dylib                     0x19cbec760 _dispatch_lane_invoke$VARIANT$mp
12 libdispatch.dylib                     0x19cbf4f00 _dispatch_workloop_worker_thread
13 libsystem_pthread.dylib               0x19ce260f0 _pthread_wqthread + 312
14 libsystem_pthread.dylib               0x19ce28d00 start_wqthread + 4

#5. com.apple.uikit.eventfetch-thread
0  libsystem_kernel.dylib         0x19cd95ed0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x19cd953a8 mach_msg + 72
2  CoreFoundation                 0x19d199fb0 __CFRunLoopServiceMachPort + 236
3  CoreFoundation                 0x19d194e4c __CFRunLoopRun + 1396
4  CoreFoundation                 0x19d1945b8 CFRunLoopRunSpecific + 436
5  Foundation                     0x19db886a4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 300
6  Foundation                     0x19db88514 -[NSRunLoop(NSRunLoop) runUntilDate:] + 88
7  UIKitCore                      0x1c976cac0 -[UIEventFetcher threadMain] + 136
8  Foundation                     0x19dcbb3b0 __NSThread__start__ + 1040
9  libsystem_pthread.dylib        0x19ce252fc _pthread_body + 128
10 libsystem_pthread.dylib        0x19ce2525c _pthread_start + 48
11 libsystem_pthread.dylib        0x19ce28d08 thread_start + 4

#6. Crashed: Thread
0  libsystem_kernel.dylib                0x19cda1104 __pthread_kill + 8
1  libsystem_pthread.dylib               0x19ce1c0e0 pthread_kill$VARIANT$mp + 380
2  libsystem_c.dylib                     0x19ccf8d78 abort + 140
3  libclang_rt.asan_ios_dynamic.dylib    0x1018111d4 __sanitizer::Abort() + 62
4  libclang_rt.asan_ios_dynamic.dylib    0x10180f9cc __sanitizer::Die() + 174
5  libclang_rt.asan_ios_dynamic.dylib    0x1017f9790 __asan::AsanCheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) + 266
6  libclang_rt.asan_ios_dynamic.dylib    0x10180fa54 __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) + 120
7  libclang_rt.asan_ios_dynamic.dylib    0x1017fc370 __asan::AsanThread::SetThreadStackAndTls(__asan::AsanThread::InitOptions const*) + 238
8  libclang_rt.asan_ios_dynamic.dylib    0x1017fbf24 __asan::AsanThread::Init(__asan::AsanThread::InitOptions const*) + 96
9  libclang_rt.asan_ios_dynamic.dylib    0x1017fc394 __asan::AsanThread::ThreadStart(unsigned long long, __sanitizer::atomic_uintptr_t*) + 36
10 libsystem_pthread.dylib               0x19ce252fc _pthread_body + 128
11 libsystem_pthread.dylib               0x19ce2525c _pthread_start + 48
12 libsystem_pthread.dylib               0x19ce28d08 thread_start + 4

Full crash log from the device is at https://pastebin.com/Rwe4QYzH

What might have caused the address sanitizer to give AsanCheckFailed error? Also when should I enabled this option under the run scheme? When I disable the option, relaunching the app works fine without any crash.

I'm looking at this video on developing complications for the apple watch and this size chart of watch complication sizes.

Currently I have my phone generate a full screen complication image on the phone and push it to the watch using background app refresh. However, I don't know how to get the correct device complication size.

The documentation suggests that I can programmatically load an image from a watch asset catalog on the watch and it will load the correct size image based on device size. I can then examine this image and determine the size. However, this would require a round trip and sending the size to the phone using WKSession.

Is there an easy way to determine ON THE PHONE what is the screen size of the apple watch? I see code that is supposed to run on the watch, but my app generates assets on the phone.

//complication - smaller devices
let width = 300.0
let height = 94.0

//complication - larger devices            
let width = 342.0
let height = 108.0

I may be able to scale the image down by 1.14 on smaller devices, but that would make the image more blurry.

I have a class which has property value of type Any I have implemented a didSet method for the value like this

if oldValue == nil && self.value != nil {
            // do something
        }
else {
    if let val = self.value as? AnyHashable, let oldVal = oldValue as? AnyHashable {
             if val != oldVal {
                    // do something 
              }
        }
 }

My value is optional type so I want to verify the nil case too. Is there are better way of doing that I do not want to cast to Anyhashasble I want them to be casted to the class they belong.

i'm creating mobile app to send location from Arabian gulf (Parisian gulf )

what the best map sdk to use it

My app is all about getting points and winning money, and what I need to do is let the user share my app then give him some points.

The problem is that I don't know how to detect if the user truly shared the app or not

I'm using the following code:

func shareTapped(){
    let text = "example"
    let url = URL(string: "example.com")
    let image = UIImage(named: "example_image")
    let shareViewController = UIActivityViewController(activityItems: [text, image!, url!] ,applicationActivities: nil)
    self.present(shareViewController, animated: true, completion: {() in
        print("done")
    })
}

The sharing method is working perfectly, but I was wondering if there is any delegate we can call in this situation.

Thanks.

Assuming My Firebase RealTime Database has the child name Users which further has sub-child which are emails like this "christianLiz@gmail.com", the sub-child emails further have sub-child called name, age, and country.

I added an observeEvent on child changed the snippets looks like this.

 ref.child("USERS").child("christianLiz@gmail,com").observe(.childChanged, with: { snapshot in

        if snapshot.exists(){
            let value = snapshot.value as? NSDictionary
            if value!["name"] != nil{
                print("here")
            }else{
                print("not here")
            }

    }){ (error) in
        print("")
    }

When i test after changing the value of country the app crashes and cause is this value!["name"]. Now i do know that the childChanged event is only returning the child which is changed in my testing scenario "country" so other values are notin snapshot but i want to check which one is updated name or age or country. How can i modify the code above to achieve this.

I've been reading a lot of articles and watching a lot of videos on Kotlin co-routines lately and, despite my efforts, I still can't make sense of them in my head.

I think I've finally found a problem that might illustrate my point:

class MyViewModel() : CoroutineScope {

override val coroutineContext = Dispatchers.Main + Job()

    fun foo() = launch(handler) {
        Log.e("test", "A")
    }
}

class MainActivity : Activity() {
    override fun onCreate() {
        MainViewModel().foo()
        Log.e("test", "B")
    }
}

The output of this is:

E/test: B
E/test: A

And I don't get how this can be the case, I'm using only one thread (the main thread). If my code executes sequentially, by the time I reach the line log(B)... log(A) should have already be printed.

Does the coroutines library use other threads internally to accomplish this? This is the only explanation I could come up with but haven't found anything saying so in the docs.

PS: Sorry for throwing android into the mix but this code:

fun main() {
    GlobalScope.launch(Dispatchers.Unconfined) { // launch new coroutine in background and continue
        print(Thread.currentThread().name + "World!") // print after delay
    }
    (0 .. 1000).forEach { print(".") }
}

seems to work as expected and prints: main @coroutine#1World!...........................

because 1 thread == sequential work

Hope my question makes sense, thanks for reading!

    i am not aware what is this error, google every where but of no use. I didnt change in any of my gradle files i tried with my

previous version also in there also it is showing the same error as i mentioned in the title i tried creating new project in there also it is showing the error like the same. i am stuck here.

       `<?xml version="1.0" encoding="utf-8"?>
        <menu xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            tools:showIn="navigation_view">

            <group android:checkableBehavior="single">
//in here i am getting the error as i mentioned in the title
                <item
                    android:id="@+id/noticeboard"
                    android:icon="@drawable/ic_notifications_active_black_24dp"
                    android:title="SSM Notice Board" />
                <item
                    android:id="@+id/nav_gallery"
                    android:icon="@drawable/ic_business_center_black_24dp"
                    android:title="Coimplaints" />
                <item
                    android:id="@+id/nav_slideshow"
                    android:icon="@drawable/ic_menu_slideshow"
                    android:title="Slideshow" />
                <item
                    android:id="@+id/nav_manage"
                    android:icon="@drawable/ic_menu_manage"
                    android:title="Tools" />
            </group>

            <item android:title="Communicate">
                <menu>

                    <item
                        android:id="@+id/nav_send"
                        android:icon="@drawable/ic_menu_send"
                        android:title="About" />
                    <item
                        android:id="@+id/Log_out_button"
                        android:icon="@drawable/ic_exit_to_app_black_24dp"
                        android:title="Logout" />
                </menu>
            </item>
        </menu>`

I am trying to make a game where the planet would be in the center of user's screen and very slowly rotate like planet would.. So first I decided to test it if everything would work fine, and it doesn't.. I get a simple "planet" image like this:

Bitmap image = BitmapFactory.decodeResource(getResources(),R.mipmap.totone);

I also have a variable that stores the angle. Then in the draw function I just rotate the canvas, draw my planet (now rotated), and rotate canvas back. like this:

//the planet's image is 512x512px
canvas.rotate(ang,256,256); //256, 256 is the center of rotation
canvas.drawBitmap(image, 0,0, null);
canvas.rotate(-ang,256,256); //rotate back

I have no idea why, but it looks like when the image is rotated by 90 and 270 degrees the game fps slows a little? I made a little gif to show the problem. The fps is perfectly 60 all the time but then it drops at 50ish for couple miliseconds for no reason? What is causing this? I tried to change my thread's target fps to 30 and it looks like no fps drops happened then.. So it's probably performance issue. Note that I tried rotating the bitmap using maany different methods, the fps drop effect is still the same..

Gif

After executing the create-react-app and enabling the service workers in the index.js, all relevant files from the src folder are cached. However some of my resources reside in the public directory. When I run npm run build, the asset-manifest.json and precache-manifest.HASH.js only contain the HTML, mangled JS and CSS (all stuff from the src folder).

How can I tell the service worker to additionally cache specific files from the public folder?

Here is the actually generated precache-manifest.e431838417905ad548a58141f8dc754b.js

self.__precacheManifest = [
  {
    "revision": "cb0ea38f65ed9eddcc91",
    "url": "/grafiti/static/js/runtime~main.cb0ea38f.js"
  },
  {
    "revision": "2c226d1577937984bf58",
    "url": "/grafiti/static/js/main.2c226d15.chunk.js"
  },
  {
    "revision": "c88c70e5f4ff8bea6fac",
    "url": "/grafiti/static/js/2.c88c70e5.chunk.js"
  },
  {
    "revision": "2c226d1577937984bf58",
    "url": "/grafiti/static/css/main.7a6fc926.chunk.css"
  },
  {
    "revision": "980026e33c706b23b041891757cd51be",
    "url": "/grafiti/index.html"
  }
];

But I want it to also contain entries for these urls:

  • /grafiti/icon-192.png
  • /grafiti/icon-512.png

They come from the public folder.

Alternatively: How can I add my icons for the manifest.webmanifest file in the src folder in a way such that I can reference them from the web manifest?

This is my first app, and I am sure I am missing something obvious but I can't figure it out - any and all help appreciated!

I have got a very basic XML layout with an EditText view in a linear layout. It is showing correctly in the XML preview but when I try to run it in the emulator to test the input, nothing is shown.

I have tried deleting the background resource I created for the EditText border, and checking the layout_width / layout_height but nothing seems to be working.

Here is my script:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical"
    >


    <EditText
        android:id="@+id/PlayerOneName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/textview_border"
        android:padding="15dp"
        android:hint="Player 1 Name"
        android:inputType="text"></EditText>



</LinearLayout>

I succeed to compile ffmpeg and to get .so files for different arch such as amreabi, armeabi-v7a, etc.

I managed to integrate these pre-built libraries to my android project using CMakeLists.txt through own .cpp wrapper. The problem is I have no skills in C++. So another way to use ffmpeg is to make a call main() function of ffmpeg.c. This link describes the steps how to do that.

In my project:

structure

Structure

Application.mk

APP_ABI := armeabi-v7a
APP_PLATFORM := android-21

Android.mk

LOCAL_PATH := $(call my-dir)
#$(warning $(LOCAL_PATH))

include $(CLEAR_VARS)
LOCAL_MODULE    := libffmpeg
LOCAL_LDLIBS := -llog -ljnigraphics -lz -landroid
LOCAL_CFLAGS := -Wdeprecated-declarations
ANDROID_LIB := -landroid
LOCAL_C_INCLUDES:=./ffmpeg
LOCAL_SRC_FILES :=  ffmpeg_controller.c ffmpeg.c ffmpeg_filter.c ffmpeg_opt.c cmdutils.c
LOCAL_SHARED_LIBRARIES := libavformat libavcodec libswscale libavutil libswresample libavfilter libavdevice

include $(BUILD_SHARED_LIBRARY)
$(call import-add-path,D:/My-Project/app/src/main/jni)
$(call import-module,ffmpeg/android/armeabi-v7a)

ffmpeg/android/armeabi-v7a/Android.mk

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE:= libavdevice
LOCAL_SRC_FILES:= lib/libavdevice-57.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libavcodec
LOCAL_SRC_FILES:= lib/libavcodec-57.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libavformat
LOCAL_SRC_FILES:= lib/libavformat-57.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libswscale
LOCAL_SRC_FILES:= lib/libswscale-4.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libavutil
LOCAL_SRC_FILES:= lib/libavutil-55.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libavfilter
LOCAL_SRC_FILES:= lib/libavfilter-6.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libswresample
LOCAL_SRC_FILES:= lib/libswresample-2.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

build.gradle

...
    ndk {
        abiFilters "armeabi", "armeabi-v7a"
    }
...
    packagingOptions {
        exclude 'META-INF/LICENSE'
        doNotStrip "*/armeabi/*.so"
        doNotStrip "*/armeabi-v7a/*.so"
        doNotStrip "*/x86/*.so"
        doNotStrip "*/x86_64/*.so"
        doNotStrip "*/arm64-v8a/*.so"
    }
...
    sourceSets.main {
        jniLibs.srcDir 'src/main/libs'
        jni.srcDirs = ["jni"] //disable automatic ndk-build call
    }
    lintOptions {
        warning 'InvalidPackage'
        warning 'MissingPermission'
        warning 'MissingConstraints'
    }
    externalNativeBuild {
        ndkBuild {
            path 'src/main/jni/Android.mk'
        }
    }

After the build project it gives many errors in ffmpeg/*.c, ffmpeg/*.h files and in jni/ffmpeg.c, jni/cmdutils.c, ect. The errors are like "config.h not found", "libavformat/os_support.h not found". If I add the config.h file to the jni/ folder from ffmpeg/ and replace libavformat/os_support.h with ffmpeg/libavformat/os_support.h then the errors are gone, but .c syntax errors still there. According to the tutorial I mustn't do such changes in sources and all should be ok.

What did I do wrong? How else I can use ffmpeg command line tool in Android Project?

Android NDK version - 13b, FFmpeg version - 3.0.12

Before that, I had hidden fields and displayed new ones. All this happened in 1 activity. Now I decided to break them into 2 activities. So that when you press the button immediately moved to the main thread. Now I have trubl with "Only the original thread that created a view hierarchy can touch its views." Also I add Handler.

public class Main3Activity extends AppCompatActivity {
    Button button1;
    TextView tv;
    ListView listView1;
    private static String TAG_SCHEDULE = "raspisanie";
    private static String TAG_ID = "id";
    private static String TAG_PREDM = "urok";
    private static String TAG_TIME = "id_day";


    ArrayList<HashMap<String, String>> scheduleList;


    private Handler handler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3);

        scheduleList = new ArrayList<HashMap<String, String>>();

        handler = new Handler() {
            @Override
            public void handleMessage(Message msg) {

                ListAdapter adapter = new SimpleAdapter(Main3Activity.this, scheduleList, R.layout.activity_column, new String[]{TAG_TIME, TAG_PREDM}, new int[]{R.id.Coldayid, R.id.ColUrok});

                ListView lv = (ListView) findViewById(R.id.listView1);
                lv.setAdapter(adapter);
            }
        };
    }

    public String url1 = "https://domex666.000webhostapp.com/rasp4.php?id_group=";
    public void tester(View view) {
        updateHTTP();
    }
    public String getURL() {
         button1 = (Button) findViewById(R.id.button1);
        Intent intent = getIntent();
        tv = (TextView) findViewById(R.id.tv);
        String grp = intent.getStringExtra("grp");
        String uri = "";
        tv.setText(grp);
        String id_group = tv.getText().toString();
        uri = url1 + id_group;
        Log.d("URL Request >>",uri);
        return uri;
    }
    protected void updateHTTP() {
        scheduleList.clear();
        Log.d("GO GO >>","START THIS PROGRAMM");

        Thread thread = new Thread(new Runnable(){
            @Override
            public void run() {
                try{
                    String newURL = getURL();
                    URL url = new URL(newURL);
                    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                    conn.setReadTimeout(10000);
                    conn.setConnectTimeout(15000);
                    conn.setRequestMethod("GET");
                    conn.setDoInput(true);
                    conn.connect();
                    InputStream stream = conn.getInputStream();
                    String data = convertStreamToString(stream);
                    Log.d("DATA >> ",data);
                    JSONObject dataJsonObj = new JSONObject(data);
                    JSONArray products = dataJsonObj.getJSONArray(TAG_SCHEDULE);

                    for(int i = 0; i < products.length();i++) {
                        JSONObject schedule = products.getJSONObject(i);
                        String id_sched = schedule.getString(TAG_ID);
                        String predm = schedule.getString(TAG_PREDM);
                        String time = schedule.getString(TAG_TIME);
                        HashMap<String, String> sched = new HashMap<String, String>();
                        sched.put(TAG_ID, id_sched);
                        sched.put(TAG_PREDM, predm);
                        sched.put(TAG_TIME,time);
                        scheduleList.add(sched);
                    }

                    Message msg = new Message();
                    msg.obj = scheduleList;
                    handler.sendMessage(msg);
                    Log.d("Request >>>>","SUCCESS");
                } catch (Exception e) {
                    Log.d("ERROR ctaciv>",e.getMessage());
                }
            }

        });

        thread.start();
    }


    static String convertStreamToString(java.io.InputStream is) {
        java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
        return s.hasNext() ? s.next() : "";
    }

}

While running test on android studio one dialog box called Edit configuration opens with error "No Bazel Target Set".

Here is the screenshotenter image description here

This is related to this question: Binding different menu with different fragment with Navigation component

I take the first approach to have a dedicated toolbar for each fragment. I enable 'up' for each toolbar like this:

    val toolbar = view.findViewById<Toolbar>(R.id.toolbar)
    (activity as HomeActivity).setSupportActionBar(toolbar)
    (activity as HomeActivity).supportActionBar!!.setDisplayHomeAsUpEnabled(true)

I also set app:defaultNavHost="true" in the main activity nav host fragment.

The issue is that clicking on the up icon in the toolbar has no effect.

Doing a back works correctly.

The official documentation only considers the case with a global toolbar in the main activity.

If I catch the action in the fragment onOptionsItemSelected and force a 'up' like this:

android.R.id.home -> findNavController().navigateUp()

Then I get a crash when the up button is clicked. It looks like this:

java.lang.IllegalArgumentException: Parameter specified as non-null is null: 
     method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter view
        at com.unludo.iotimetracker.HomeActivityFragment.onItemSelected(Unknown Source:45)
        at android.widget.AdapterView.fireOnSelected(AdapterView.java:944)
        at android.widget.AdapterView.dispatchOnItemSelected(AdapterView.java:933)

For me, it means the the event goes in the 'up fragment' and is badly managed.

Do you guys have an idea why the up button is not working? Or a possible solution?

thanks! :)

i have a service in my app that has some process. but app permission monitor will tell user myApp using some feature(this will happen in android 8). how can i stop app permission monitor programmatically or what should i do to stop showing notification about my app

I am working on a Battleship game on Andriod Studio. So far, I have managed to place a grid on the screen and hard-code the position of the ships. The board is interactive and changes colour. I now want to compute whether you've won or loss. I need to implement a computer that guesses where ships on another board are.

If anyone could help, that would be great.

/**
* This class provides the logic for the players guess activity.
*
* 
*/
package com.example.jack.battleshipsapplication;

public class GuessActivity extends BattleshipGameBase<BattleshipGameBase.ShipData> {

public static final int DEFAULT_COLUMNS = 10;
public static final int DEFAULT_ROWS = 10;
private int mColumn = 10;
private int mRow = 10;
private int[][] placedShipGrid;
private int[][] currentGuesses;

protected GuessActivity(int columns, int rows, ShipData[] ships) {
    super(columns, rows, ships);

    placedShipGrid = new int[columns][rows];
    currentGuesses = new int[columns][rows];
    for (int col = 0; col < columns; col++) {
        for (int row = 0; row < rows; row++) {
            placedShipGrid[col][row] = CELL_UNSET;
            currentGuesses[col][row] = CELL_UNSET;
        }
    }

    for (int shipIndex = 0; shipIndex < ships.length; shipIndex++) {
        int shipTop = ships[shipIndex].getTop();
        int shipLeft = ships[shipIndex].getLeft();
        int shipRight = ships[shipIndex].getRight();
        int shipBottom = ships[shipIndex].getBottom();

        for (int col = shipLeft; col <= shipRight; col++) {
            for (int row = shipTop; row <= shipBottom; row++) {
                placedShipGrid[col][row] = shipIndex;
            }
        }
    }
}

@Override

public int placedCell(int column, int row) {

    return placedShipGrid[column][row];
}

@Override
public int currentGuessAt(int column, int row) {

    return currentGuesses[column][row];
}

//Logic to work out if a ship was hit when a user touches the grid.
public void takeAShot(int column, int row) {
    if (currentGuesses[column][row] == CELL_UNSET) {
        int shipAtPos = placedShipGrid[column][row];
        if (shipAtPos == CELL_UNSET) {
            // There is no ship here.
            currentGuesses[column][row] = CELL_EMPTY;

        } else {
            // there is a ship.
            currentGuesses[column][row] = SHIP_HIT;
            ShipData ship = getShips()[shipAtPos];
            boolean shipSunk = true;
            for (int x = ship.getLeft(); x <= ship.getRight(); x++) {
                for (int y = ship.getTop(); y <= ship.getBottom(); y++) {
                    shipSunk = shipSunk && (currentGuessAt(x, y) == SHIP_HIT);
                }
            }
            if (shipSunk) {
                for (int x = ship.getLeft(); x <= ship.getRight(); x++) {
                    for (int y = ship.getTop(); y <= ship.getBottom(); y++) {
                        currentGuesses[x][y] = SHIP_SUNK_BASE + shipAtPos;
                    }
                }
            }
        }
        fireOnGameChangeEvent(column, row); //Change the games state after a ship has been sunk.
    }
}
 }

Right now we can create Github pages for a project repo using a url like so:

http://username.github.io/repository

the problem I am having is I want to be able to version the docs for each version of the repo, for example each git tag.

So I am looking to publish docs like this:

http://username.github.io/repository/1.1
http://username.github.io/repository/1.2
http://username.github.io/repository/2.0
http://username.github.io/repository/2.1

what is the best way to store documenation by version? I can't think of a good way to do this. I can manually create a site with a sidepanel that has links to each version, but what url will the links point to?

I'm very confused about this. In most programming languages, there are string.ToUpperCase(), string.ToLowerCase(), sometimes Capitalize() (which capitalize the first letter of the string), even ToTitleCase() which capitalize every first letter of everyword.

But why isn't there any ToCommonSenseCase()? The one that capitalize the first letter of each sentence? Why doesn't any language have it? I thought it should be the first utility function to implement case-wise.

I've used different Xcode versions in the past and now I started using Xcode 10.1 on a new mac mini 2018. As soon as I created a new project I get this error. error that I encounter