我正在做一个需要Android中的Spotify的应用程序。但是当我运行libSpotify"sp_session_create"时,我得到了一个SIGSEGV。我正在使用的libSpotify版本是v12.1.51 BETA - 适用于android ARM
sp_error initialise(const char * asKey,
const char * asFolder,
const char * asUserAgent,
bool isPlaylistCompressed,
bool isMetadataOnPlaylist,
bool isPlaylistInitialUnload)
{
sp_session_callbacks asCallbacks;
memset(&asCallbacks, 0, sizeof(asCallbacks));
asCallbacks.logged_in = Callback::onSessionLogin;
asCallbacks.log_message = Callback::onSessionLog;
sp_session_config asConfiguration;
memset(&asConfiguration, 0, sizeof(asConfiguration));
std::string asDirectory = asFolder;
auto asDirectoryCache = asDirectory + "/cache";
auto asDirectorySetting = asDirectory + "/setting";
const auto asApplicationKey = "Key goes here...";
asConfiguration.api_version = SPOTIFY_API_VERSION;
asConfiguration.application_key = asApplicationKey;
asConfiguration.application_key_size = sizeof(asApplicationKey);
asConfiguration.cache_location = asDirectoryCache.c_str();
asConfiguration.settings_location = asDirectorySetting.c_str();
asConfiguration.user_agent = asUserAgent;
asConfiguration.compress_playlists = isPlaylistCompressed;
asConfiguration.dont_save_metadata_for_playlists = isMetadataOnPlaylist;
asConfiguration.initially_unload_playlists = isPlaylistInitialUnload;
asConfiguration.userdata = this;
asConfiguration.callbacks = &asCallbacks;
sp_error asError = sp_session_create(&asConfiguration, &_asSession);
__android_log_print(ANDROID_LOG_VERBOSE, LIBRARY_NAME, "PASSED");
return asError;
}
崩溃是由于缓存文件夹。
编辑:Spotify的新Android SDK发布!您应该强烈考虑将您的项目迁移到新的SDK,因为libspotify现在已弃用该平台。