Status Update
Comments
qu...@gmail.com <qu...@gmail.com> #2
I got an Android Studio project with a native C++ implementation.
when I put the following instruction in CMakeLists
file(GLOB_RECURSE CPP_SOURCE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/cpp/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/cpp/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/cpp/*.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/cpp/*.c")
It seems that CMAKE_CURRENT_SOURCE_DIR points to the root directory, in my case C:/
So when it is scanning for files and indexing, it tryes to index the whole HD partition and it takes so long
I also tryed:
file(GLOB_RECURSE CPP_SOURCE_FILES1 "${CMAKE_CURRENT_SOURCE_DIR}/cpp/*.cpp")
file(GLOB_RECURSE CPP_SOURCE_FILES2 "${CMAKE_CURRENT_SOURCE_DIR}/cpp/*.hpp")
file(GLOB_RECURSE CPP_SOURCE_FILES3 "${CMAKE_CURRENT_SOURCE_DIR}/cpp/*.c")
file(GLOB_RECURSE CPP_SOURCE_FILES4 "${CMAKE_CURRENT_SOURCE_DIR}/cpp/*.h")
set(files CPP_SOURCE_FILES1 CPP_SOURCE_FILES2 CPP_SOURCE_FILES3 CPP_SOURCE_FILES4)
But is the same result.
What is the proper way to use GLOB_RECURSE and to point to the current source directory?
my full CMakeLists.txt
cmake_minimum_required(VERSION 3.4.1)
set(PATH_TO_LIBRARY "C:/Repositories/LibrarySDK/library")
set(PATH_TO_FIREBASE "C:/Repositories/firebase_cpp_sdk")
set(PATH_TO_SQLITE "C:/Repositories/sqlite-amalgamation")
set(PATH_TO_LIBPNG "C:/Repositories/libpng-android-master")
# LIST(APPEND PATH_TO_PUGIXML "C:/Repositories/pugixml-1.8/src")
set(SOURCE_DIR src message(${ANDROID_ABI}))
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/cpp)
include_directories(${PATH_TO_LIBRARY})
include_directories(${PATH_TO_FIREBASE}/include)
include_directories(${PATH_TO_FIREBASE}/include/firebase)
include_directories(${PATH_TO_SQLITE})
include_directories(${PATH_TO_LIBPNG}/jni)
# include_directories(${PATH_TO_PUGIXML})
include_directories(C:/Users/FENYX/AppData/Local/Android/sdk/ndk-bundle/sources/android/cpufeatures)
############## SOURCE ###############
##file(GLOB_RECURSE CPP_QUETZALFIR_FILES "./*.cpp" "./*.hpp" "./*.c" "./*.h" )
## "${CMAKE_CURRENT_SOURCE_DIR}/*.h"
## "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp"
## "${CMAKE_CURRENT_SOURCE_DIR}/*.c")
# set(files "${h_files}" "${hpp_ipp_files}")
file(GLOB_RECURSE CPP_SOURCE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/cpp/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/cpp/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/cpp/*.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/cpp/*.c")
add_library (
NativeEngine
SHARED
${CPP_SOURCE_FILES}
${PATH_TO_LIBRARY}/AndroidIO/LibraryAndroidIO.cpp
)
#########################################
########## SQLITE 3 ##########
file(GLOB CPP_SQLITE3
"${PATH_TO_SQLITE}/*.h"
"${PATH_TO_SQLITE}/*.c")
add_library (
Sqlite3
SHARED
${CPP_SQLITE3}
)
##############################
add_library(libpng STATIC IMPORTED)
set_target_properties(libpng PROPERTIES IMPORTED_LOCATION
${PATH_TO_LIBPNG}/obj/local/${ANDROID_ABI}/libpng.a)
target_link_libraries (
NativeEngine
Sqlite3
libpng
log
GLESv2
EGL
android
OpenSLES
z
${PATH_TO_LIBRARY}/libraryAndroid${ANDROID_ABI}.a
${PATH_TO_FIREBASE}/libs/android/${ANDROID_ABI}/c++/libapp.a
${PATH_TO_FIREBASE}/libs/android/${ANDROID_ABI}/c++/libanalytics.a
)
My CMake version is 3.6.41, I have tried to use the 3.10.2 version but I don't know why Android Studio forces the 3.6 version, even if I put it in the gradle file.
rm...@google.com <rm...@google.com> #3
uc...@google.com <uc...@google.com>
ra...@google.com <ra...@google.com> #4
jo...@google.com <jo...@google.com> #5
I can't tell from the information in this bug but possibly this is a case of this bug:
Please provide a minimal repro case.
qu...@gmail.com <qu...@gmail.com> #6
I have done a complete and clean reinstallation of Android Studio, and updated to the last stable version, and the problem persists.
A workaround that I have found is that when I see that is indexing "C:\" in the "Project Source Files" pane. I go to the app.iml file and remove the content tag that has the "C:\" and save the file. That does that it stops the indexation of "C:\" and continue with the correct source directories.
But that makes that when the indexation "ends", it gets "stuck" (actually looks like is loading something, but never ends), in order to solve that I go to the Gradle pane and refresh the gradle project. When it is finally done, the indexing also ends and Android Studio allows me to build the project.
jo...@google.com <jo...@google.com> #7
[Deleted User] <[Deleted User]> #8
From
on 1/20/2019: issue 122874775
Same here, but on macOS High Sierra, Android Gradle Plugin 3.3.0, Gradle: 4.10.1, NDK 18.1.5063045, using ndk-build.
Scanning files to index was taking hours, so I left it overnight. In the morning I find the Android Studio process had read 185.35 GB from the disk and is now asking for more RAM. It either tries to read my whole disk (which is about 400 GB), or reads the same data over and over again. I'm not going to give this thing more RAM to do more of what it does now.
I never imagined that it can get any worse than Android Studio 3.2, but 3.3 is plain unusable.
[Deleted User] <[Deleted User]> #9
From
on 1/20/2019: issue 122874775
Same here, but on macOS High Sierra, Android Gradle Plugin 3.3.0, Gradle: 4.10.1, NDK 18.1.5063045, using ndk-build.
Scanning files to index was taking hours, so I left it overnight. In the morning I find the Android Studio process had read 185.35 GB from the disk and is now asking for more RAM. It either tries to read my whole disk (which is about 400 GB), or reads the same data over and over again. I'm not going to give this thing more RAM to do more of what it does now.
I never imagined that it can get any worse than Android Studio 3.2, but 3.3 is plain unusable.
Description
I think I found the problem. It seems that the file app.iml has a component that has a content like next:
<content url="file://C:/">
<sourceFolder url="file://C:/" isTestSource="false" />
</content>
I don't know why Android Studio is genereting this tag, but every time that the IDE tries to index, it indexes the whole partition! So it gets stuck or takes so long to finish.
I think it could be my CMakeList or the gradle configuration.
How can I prevent this tag to appear?
my gradle:
apply plugin: 'com.android.application'
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def firebase_sdk_path = properties.getProperty('firebase.dir')
def sqlite_path = properties.getProperty('sqlite.dir')
def libpng_path = properties.getProperty('libpng.dir')
android {
compileSdkVersion 28
defaultConfig {
applicationId "
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86'//, 'x86_64'
// these platforms cover 99% percent of all Android devices
}
externalNativeBuild {
cmake {
arguments '-DANDROID_PLATFORM=android-16',
'-DANDROID_ARM_NEON=TRUE', '-DANDROID_STL=c++_shared',
"-DPATH_TO_FIREBASE:STRING=${firebase_sdk_path}",
"-DPATH_TO_SQLITE:STRING=${sqlite_path}",
"-DPATH_TO_LIBPNG=${libpng_path}"
cFlags '-O3', '-fsigned-char' // full optimization, char data type is signed
cppFlags '-std=c++11', '-fsigned-char',
"-I${firebase_sdk_path}",
"-I${sqlite_path}",
"-I${libpng_path}"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
proguardFile file(firebase_sdk_path + "/libs/android/
proguardFile file(firebase_sdk_path + "/libs/android/
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
}
}
flavorDimensions "demo", "full"
productFlavors {
demo {
dimension "demo"
//applicationIdSuffix ".demo"
}
full {
dimension "full"
//applicationIdSuffix ".full"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
//implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-games:16.0.0'
implementation "com.google.android.gms:play-services-auth:16.0.1"
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-analytics:16.0.6'
}
apply plugin: 'com.google.gms.google-services'
my CMakeList:
cmake_minimum_required(VERSION 3.4.1)
set(PATH_TO_FIREBASE CACHE STRING "")
set(PATH_TO_SQLITE CACHE STRING "")
set(PATH_TO_LIBPNG CACHE STRING "")
set(SOURCE_DIR src message(${ANDROID_ABI}))
include_directories(${PATH_TO_FIREBASE}/include)
include_directories(${PATH_TO_FIREBASE}/include/firebase)
include_directories(${PATH_TO_SQLITE})
include_directories(${PATH_TO_LIBPNG}/jni)
include_directories(${PATH_TO_PUGIXML})
include_directories(C:/Users/FENYX/AppData/Local/Android/sdk/ndk-bundle/sources/android/cpufeatures)
file(GLOB_RECURSE CPP_Native_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
add_library (
NativeEngine
SHARED
${CPP_Native_FILES}
)
file(GLOB CPP_SQLITE3 "${PATH_TO_SQLITE}/*.h")
add_library (
Sqlite3
SHARED
${CPP_SQLITE3}
)
add_library(libpng STATIC IMPORTED)
set_target_properties(libpng PROPERTIES IMPORTED_LOCATION
${PATH_TO_LIBPNG}/obj/local/${ANDROID_ABI}/libpng.a)
target_link_libraries (
NativeEngine
Sqlite3
libpng
log
GLESv2
EGL
android
OpenSLES
z
)
Build: 3.3, AI-182.5107.16.33.5199772, 201812250239,
AI-182.5107.16.33.5199772, JRE 1.8.0_152-release-1248-b01x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1366x768
Android Gradle Plugin: 3.3.0
Gradle: 4.10.1
NDK: from local.properties: 19.0.5232133; latest from SDK: 19.0.5232133;
LLDB: LLDB 3.1 (revision: 3.1.4508709)
CMake: from local.properties: (not specified); latest from SDK: 3.6.0-rc2; from PATH: (not found);
Source: user_sentiment_feedback