Mobile Detect - Ludwig integration

Created on 9 January 2021, almost 4 years ago
Updated 1 October 2023, about 1 year ago

Problem/Motivation

I have a multi-site Drupal 9 setup, created without composer. When trying to install the Mobile Detect module, I receive the following error:

Error: Class 'Detection\MobileDetect' not found in Drupal\Component\DependencyInjection\Container->createService() (line 257 of core/lib/Drupal/Component/DependencyInjection/Container.php).

I'm guessing this relates to the placement of the Mobile_Detect.php library, but I've variously tried the following locations without success:

  • /libraries/Mobile_Detect/Mobile_Detect.php
  • /libraries/mobile_detect/Mobile_Detect.php
  • /sites/all/libraries/Mobile_Detect.php
  • /sites/default/libraries/Mobile_Detect.php
  • /sites/[multisite subsite]/libraries/Mobile_Detect.php

The Mobile Detect module's README.txt indicates that some of the above locations should work. However, the error is such that the site is rendered unusable - no admin pages can be accessed; flushing cache via Drush won't work (error message is display in shell); deleting the module results in a 'module not found' error. The only way to resurrect the site is to roll back the database using a backup.

Do you have any advice on where the Mobile_Detect.php should be located in Drupal 9, and should the README.txt file be update to reflect this?

Steps to reproduce

Install Mobile Detect module on Drupal 9 via 'Install new module' UI (without using composer); download and place Mobile_Detect library manually according to README.txt advice.

Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom patgibbs

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024